[SERVER-3244] no error returned if an update $rename operation fails Created: 12/Jun/11  Updated: 07/Mar/14  Resolved: 22/Sep/11

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

Type: Bug Priority: Minor - P4
Reporter: Dwight Merriman Assignee: Tony Hannan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

renaming a->b if a DNE is not an error i guess. but the following is as it isn't allowed, yet no error set.
> t.find()
{ "_id" : ObjectId("4df4da0dd5184551b584cf37"), "a" :

{ "c" : 3 }

}
> t.update({},{$rename:{"a.b":"top"}}); db.getLastErrorObj()
{
"updatedExisting" : true,
"n" : 1,
"connectionId" : 2,
"err" : null,
"ok" : 1
}
> t.find()
{ "_id" : ObjectId("4df4da0dd5184551b584cf37"), "a" :

{ "c" : 3 }

}



 Comments   
Comment by Tony Hannan [ 22/Sep/11 ]

rename "a.b" to "d" is valid, it moves it out.

> db.foo.find()
{ "_id" : 2, "a" : { "b" : 1, "c" : 2 }, "x" : 2 }
> db.foo.update({_id:2},{$rename: {"a.b":"d"}}); db.getLastErrorObj()
{
	"updatedExisting" : true,
	"n" : 1,
	"connectionId" : 1,
	"err" : null,
	"ok" : 1
}
> db.foo.find()
{ "_id" : 2, "a" : { "c" : 2 }, "d" : 1, "x" : 2 }
> db.foo.update({_id:2},{$rename: {"a.b":"d"}}); db.getLastErrorObj()
{
	"updatedExisting" : true,
	"n" : 1,
	"connectionId" : 1,
	"err" : null,
	"ok" : 1
}

However, I question weather a no-op like the second update should report "updateExisting" = true. But that would be another ticket.

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