deyles-zz / sculejs

SculeJS - data structures for the web
165 stars 24 forks source link

Upsert and $set issues #62

Closed tityrus closed 7 years ago

tityrus commented 7 years ago

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.

tityrus commented 7 years ago

In the end this one was due to #63 , please refer to that ticket.