[SERVER-2891] Update was a no-op but reported a change Created: 03/Apr/11  Updated: 07/Mar/14  Resolved: 03/Apr/11

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

Type: Bug Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

> db.b.findOne()
{
"_id" : ObjectId("4d9785a5e8cf7bf87ef7a681"),
"groups" : [

{ "groupId" : ObjectId("4d9733172eda11cf36199d6b"), "addTime" : ISODate("2011-04-02T20:28:46.442Z") }

,

{ "groupId" : ObjectId("4d9733172eda11cf36199d6c"), "addTime" : ISODate("2011-04-02T20:28:46.442Z") }

]
}
// I made a mistake here when it should have included "groups" like this: { $pull : { groups : { groupId....
> db.b.update({_id:ObjectId("4d9785a5e8cf7bf87ef7a681")}, {$pull: { groupId:new ObjectId("4d9733172eda11cf36199d6b")}})
> db.getLastErrorObj()
{
"updatedExisting" : true,
"n" : 1,
"connectionId" : 16,
"err" : null,
"ok" : 1
}
//doesn't look updated to me.
> db.b.findOne()
{
"_id" : ObjectId("4d9785a5e8cf7bf87ef7a681"),
"groups" : [

{ "groupId" : ObjectId("4d9733172eda11cf36199d6b"), "addTime" : ISODate("2011-04-02T20:28:46.442Z") }

,

{ "groupId" : ObjectId("4d9733172eda11cf36199d6c"), "addTime" : ISODate("2011-04-02T20:28:46.442Z") }

]
}



 Comments   
Comment by Eliot Horowitz (Inactive) [ 03/Apr/11 ]

Those numbers mean how many things was the update applied to.
We could add a new counter called # of docs actually changed.
But that would be a new feature.

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