[CSHARP-444] MongoCollection<T>.FindAndModify not returning modified document when returnNew set to true Created: 13/Apr/12  Updated: 20/Mar/14  Resolved: 13/Apr/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Paul Brower Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: Driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 Ultimate 64-bit, 24GB ram, Dell Precision T3500



 Description   

When calling MongoDB.Driver.FindAndModifyResult, with returnNew set to true, the FindAndModifyResults shows the following. ModifiedDocuement should not be null

_command { "findAndModify" : "Swine", "query" :

{ "Id" : "4f84ba26b71e9a2324104c9e" }

, "update" : { "$set" :

{ "RFID" : "empty" }

}, "new" : true } MongoDB.Driver.IMongoCommand

{MongoDB.Driver.CommandDocument}

_response

{ "value" : null, "ok" : 1.0 }

MongoDB.Bson.BsonDocument

Ok true bool

ModifiedDocument null MongoDB.Bson.BsonDocument



 Comments   
Comment by Paul Brower [ 13/Apr/12 ]

Please close this issue. The problem was that the "Id" needed to be converted to an ObjectId. The following command works as expected:

_command { "findAndModify" : "Swine", "query" :

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

, "update" : { "$set" :

{ "RFID" : "empty" }

}, "new" : true } MongoDB.Driver.IMongoCommand

{MongoDB.Driver.CommandDocument}
Comment by Paul Brower [ 13/Apr/12 ]

One additional comment: The repository is NOT getting the update. The 'RFID' element value should be getting set to "empty", but it is not.

Generated at Wed Feb 07 21:36:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.