-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Currently we can do:
foo=db.kg.findAndModify({query:
{"dogs":2},update:{$inc:
{"dogs":1}}})
{ "_id" : ObjectId("4bc665954c25a502cc9c76ef"), "dogs" : 2 }foo
{ "_id" : ObjectId("4bc665954c25a502cc9c76ef"), "dogs" : 2 }db.kg.find()
{ "_id" : ObjectId("4bc665954c25a502cc9c76ef"), "dogs" : 3 }I think this would be nicer:
foo=db.kg.update({},{$inc:{"dogs":1}} )
foo
and perhaps even:
foo=db.kg.update({},{$inc{"dogs":1}},{$inc{"cats":1}})
foo
Returning the incremented value allows applications to use the newly generated value