Skip to content

update with dot properties #41

@SamVerschueren

Description

@SamVerschueren

It's not possible to udpate a sub-document that does not exist like this.

{
    "id": "foo"
}
Table.update({id: 'foo'}, {$set: {'foo.bar': 'baz'}}).exec();

It has to be done like this

Table.update({id: 'foo'}, {$set: {foo: {bar: 'baz'}}}).exec();

But this might override other properties inside the foo object.

{
    "id": "foo",
    "foo": {
        "bar": "bar",
        "baz": "baz"
    }
}
Table.update({id: 'foo'}, {$set: {foo: {bar: 'baz'}}}).exec();

will result in

{
    "id": "foo",
    "foo": {
        "bar": "baz"
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions