Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
None
-
*Location*: http://docs.mongodb.org/manual/reference/command/findAndModify/
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
*Referrer*: https://www.google.com/
*Screen Resolution*: 1440 x 900
*repo*: docs
*source*: reference/command/findAndModify
*Location*: http://docs.mongodb.org/manual/reference/command/findAndModify/ *User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36 *Referrer*: https://www.google.com/ *Screen Resolution*: 1440 x 900 *repo*: docs *source*: reference/command/findAndModify
Description
The docs for the "upsert" parameter are incomplete. They state what will happen if the "query" parameter matches no documents, but they don't say what would happen if the "query" parameter does match some documents.
I wrote some code that assumed it worked as documented. I thought it was stupid that an upsert operation only did inserts and not updates, but I figured someone had just chosen a bad parameter name. I was wrong. It works as intended, but not as documented.