[SERVER-3332] findAndModify + fields returns nothing but _id Created: 24/Jun/11  Updated: 29/Aug/11  Resolved: 24/Jun/11

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.8.2
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Jonas H Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

1) > db.test.find()

{ "_id" : ObjectId("4e04e3d79c57c1b8fe3830af"), "v" : 11 }

2) > db.test.findAndModify({query: {}, update: {'$inc': {v: 1}}, new: true})

{ "_id" : ObjectId("4e04e3d79c57c1b8fe3830af"), "v" : 12 }

3) > db.test.findAndModify({query: {}, update: {'$inc': {v: 1}}, new: true, fields: ['v']})

{ "_id" : ObjectId("4e04e3d79c57c1b8fe3830af") }

Output of 3) should contain the 'v' field.

Same thing with the Python driver; with new=False and with multiple fields.



 Comments   
Comment by Jonas H [ 24/Jun/11 ]

Sorry, confused Shell and Python driver syntax. This is a Python driver issue. https://jira.mongodb.org/browse/PYTHON-259

Comment by Scott Hernandez (Inactive) [ 24/Jun/11 ]

3) should be findAndModify({query: {}, update: {'$inc': {v: 1}}, new: true, fields: {v:1}})

Generated at Thu Feb 08 03:02:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.