When I run this code for example:
collection.update({id: item.id}, item, null, true, null);
I expect it to update the document if the item with this ID exists, and if not (upsert) insert a new document with that ID and data. But if the document doesn't exist, nothing seems to happen...
2) $set + upsert
To do an update on existing documents, but keeping original fields, I'm trying to use this:
collection.update({id: item.id}, {$set: item}, null, true, null);
According to the documentation, the upsert in this context means create the attributes even if they don't exist. Will this also create the whole document if it didn't exist for the provided query?
I'm using the latest build from the master branch.
1) update + upsert
When I run this code for example:
collection.update({id: item.id}, item, null, true, null);
I expect it to update the document if the item with this ID exists, and if not (upsert) insert a new document with that ID and data. But if the document doesn't exist, nothing seems to happen...2) $set + upsert
To do an update on existing documents, but keeping original fields, I'm trying to use this:
collection.update({id: item.id}, {$set: item}, null, true, null);
According to the documentation, the upsert in this context means create the attributes even if they don't exist. Will this also create the whole document if it didn't exist for the provided query?I'm using the latest build from the master branch.