Details
-
Bug
-
Resolution: Done
-
Major - P3
-
mongodb-3.0
Description
The 3.0 docs for findAndModify have a section on the output of the command, and then a subsection with a note. In that note, the last two bullet points no longer apply.
E.g.
> db.foo.drop()
|
true
|
> db.runCommand({findAndModify: 'foo', query: {_id: 'doc_with_sort'}, update: {$inc: {i: 1}}, upsert: true, new: false, sort: {_id: -1}})
|
{
|
"value" : null,
|
"lastErrorObject" : {
|
"updatedExisting" : false,
|
"n" : 1,
|
"upserted" : 'doc_with_sort'
|
},
|
"ok" : 1
|
}
|
> db.runCommand({findAndModify: 'foo', query: {_id: 'doc_without_sort'}, update: {$inc: {i: 1}}, upsert: true, new: false})
|
{
|
"value" : null,
|
"lastErrorObject" : {
|
"updatedExisting" : false,
|
"n" : 1,
|
"upserted" : 'doc_without_sort'
|
},
|
"ok" : 1
|
}
|
Notice both with and without the sort parameter, value is null.
Attachments
Issue Links
- is duplicated by
-
SERVER-17650 findAndModify regression when upserting with sort and new is false
-
- Closed
-
- related to
-
DOCS-5489 [SERVER] Comment on: "manual/reference/command/findAndModify.txt"
-
- Closed
-