-
Type:
Bug
-
Resolution: Gone away
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
(copied to CRM)
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Summary
The SingleResult from collection.findOneAndUpdate({"doesnotexist": "hi"}, {$set: {"hello", "world", {upsert: true})}} contains a no documents in result error if the find query does not find a document and upsert is true. The document is successfully inserted into the db despite the error. It appears that the error is coming from the driver since upsert returns null unless the returnNewDocument option is also true in the updateOptions
Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
How to Reproduce
Reproduced in 1.7.3 by calling findOneAndUpdate in the example above
Additional Background
It seems like in this specific scenario, the SingleResult should not contain an error especially since the document was inserted correctly