Open Signorini opened 7 years ago
Hi Signorini,
I was facing the same problem. I found out that, in my case, all I needed to do was transform the "_id" String representation into a actual ObjectId object. Try this instead:
//import from native driver
const ObjectID = require('mongodb').ObjectID;
//will insert or update
let post = {_id: ObjectID("fsdfsdasasd"), changeme: true}
new Post(post).save()
//... Other stuff happening
//will update
let postAgain = {_id: ObjectID("fsdfsdasasd"), changeme: false}
new Post(postAgain ).save()
By the way... not tested ;)
Where way to make update document without using find?
I try to
let post = {_id: "fsdfsdasasd", changeme: true}
new Post(post).save()
//or
new Post(post).update()
but dont change