seneca-mongo-store icon indicating copy to clipboard operation
seneca-mongo-store copied to clipboard

is findOne needed after upsert?

Open rjrodger opened this issue 3 years ago • 2 comments

does the upsert not return the updated document?

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

rjrodger avatar Jun 08 '21 22:06 rjrodger

this was a question - please reply via comment here

rjrodger avatar Jun 18 '21 10:06 rjrodger

@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.

lilsweetcaligula avatar Jun 18 '21 10:06 lilsweetcaligula