[SERVER-2626] Excluding _id field doesn't work with FindAndModify Created: 25/Feb/11  Updated: 12/Jul/16  Resolved: 31/May/11

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: 1.9.1

Type: Bug Priority: Major - P3
Reporter: Alex Brown Assignee: Mathias Stearn
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 64


Issue Links:
Depends
depends on SERVER-1117 don't use DBDirectClient in findAndMo... Closed
Duplicate
is duplicated by SERVER-3050 Suppressing output of '_id' from find... Closed
is duplicated by SERVER-3757 findAndModify can't handle {fields: {... Closed
Operating System: ALL
Participants:

 Description   

If I have the following document:

db.sequence.findAndModify({
query:

{"_id": "customer"}

,
update : {$inc : {"seq":1}},
fields:

{"_id":0}

,
upsert:true,
new:true})

Notice the fields:

{"_id":0}

, part-
According to the documentation, this should prevent the id from being returned, however when I try and execute this command, I get this error:

Uncaught exception: findAndModifyFailed failed: "exception: assertion c:\\builds\laves\\mongo\\windows_64bit_v1.6\\mongo\\db
../bson/bsonbjbuilder.h:115"



 Comments   
Comment by auto [ 31/May/11 ]

Author:

{u'login': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: Make findAndModify work when _id is removed in projection SERVER-2626
Branch: master
https://github.com/mongodb/mongo/commit/c117c4c2ea62201078f6a46b8bbed173f78746da

Comment by Mathias Stearn [ 28/Feb/11 ]

This is a limitation based on how FindAndModify is implemented. We are planning on reimplementing it which should remove this restriction

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