Reputation: 11572
I am using this code to make upsert functiona to mongo server via mongoose
update({'name' : 'Jaki'}, {'name' : 'Charley', 'gender' : 'f'}, {upsert: true})
and it works, but how to know if operation was successful and if I can get _id
of updated/new inserted document?
(In sqlalchemy after session flush() I can get id of orm updated/inserted)
Upvotes: 1
Views: 97
Reputation: 19474
You have to use findAndModify to get the modified records. Do not forget upsert:true
.
Upvotes: 1