scottwrobinson / camo

A class-based ES6 ODM for Mongo-like databases.
556 stars 80 forks source link

Documents broken? Update broken? save broken? #77

Open jlsjonas opened 8 years ago

jlsjonas commented 8 years ago

Camo looked like an interesting project, however I'm experiencing MAJOR issues with it... I declared a schema (extends document class) loosely based on Slack's user model (with some extra things added) however; using either findOneAndUpdate or instance.save() does note save to DB only the INITIAL creation is saved when using findOneAndUpdate in combination with upsert:true.

It's like only .create(), .find() and .findOne() are working as expected

Am I missing something obvious? or is there something badly wrong with camo?

jamespegg commented 8 years ago

Have you got a code example?

For findOneAndUpdate I had to add the following option to insert a new record if it couldn't find one : {upsert: true}.

scottwrobinson commented 8 years ago

@jlsjonas This is long overdue, but did you figure out your issue? I'd be happy to take a look at a code example if you're still having troubles. If not, please close the issue.

Thanks!