|
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.
|