amark / mongous

Simple MongoDB driver for Node.js with jQuery like syntax.
MIT License
246 stars 30 forks source link

method save() not work #44

Closed DonaldDu closed 8 years ago

DonaldDu commented 8 years ago

currently: mongous.prototype.save = function(a) { return this.update(a, a, 1); }; I think shoud be so, I tested. mongous.prototype.save = function(a) { return this.update({a._id}, a, true); };

amark commented 8 years ago

@DonaldDu thanks! Were you able to come up with a fix? Would love you to contribute it.

I'm a bit baffled why save souldn't work any more, I haven't changed the code in a long time. Do you have a sample script I could run to see what is happening?

BTW, given problems I've had with MongoDB, I'm building a better database - you should check it out: github.com/amark/gun . It has realtime sync (think like an Open Source Firebase) and all sorts of cool stuff.

DonaldDu commented 8 years ago

currently: mongous.prototype.save = function(a) { return this.update(a, a, 1); }; if new just create one. else something updated. there can't be one match the updated for all fileds in the database. but the _id already existed, create new one failed.

amark commented 8 years ago

Sorry, I had a baby and then got distracted with holidays and a ton of work. Now just went back through emails and saw this.

I'm not sure I understand your previous message. I would still need a script I can run to replicate the problem as well as what version of MongoDB you are on.

I'm going to close this issue since it has been a while, feel free to open/comment it again though with the above info.