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