senecajs / seneca-mongo-store

Node.js Seneca data storage plugin for MongoDB
MIT License
35 stars 43 forks source link

is findOne needed after upsert? #95

Open rjrodger opened 3 years ago

rjrodger commented 3 years ago

does the upsert not return the updated document?

https://github.com/senecajs/seneca-mongo-store/blob/master/mongo-store.js#L230

rjrodger commented 3 years ago

this was a question - please reply via comment here

lilsweetcaligula commented 3 years ago

@rjrodger No, the call to findOne is not required. Both findOneAndUpdate and findOneAndReplace return the new/updated document if the option returnOriginal: false is passed to them.