|
The renameCollection command will incorrectly roll back the collection drop when renaming a collection across databases with the {dropTarget: true} option. The command will fail with the error message "collection already exists" when this happens. Affects 2.7.8.
To reproduce:
> use test
|
switched to db test
|
> db.foo.drop()
|
true
|
> db.foo.insert({})
|
WriteResult({ "nInserted" : 1 })
|
> db.getSiblingDB("test2").bar.drop()
|
false
|
> db.getSiblingDB("test2").bar.insert({})
|
WriteResult({ "nInserted" : 1 })
|
> db.adminCommand({renameCollection:"test.foo",to:"test2.bar",dropTarget:true})
|
{
|
"errmsg" : "exception: collection already exists",
|
"code" : 17399,
|
"ok" : 0
|
}
|
|