> db.foo.insert({x: 1})
WriteResult({ "nInserted" : 1 })
> db.foo.renameCollection(".")
{ "ok" : 1 }
> db.listCollections()
uncaught exception: TypeError: db.listCollections is not a function :
@(shell):1:1
> show tables
.
bug
> db[".foo"].insert({x: 1})
WriteCommandError({
"ok" : 0,
"errmsg" : "Collection names cannot start with '.'",
"code" : 73,
"codeName" : "InvalidNamespace"
})
It seems like we're just missing some validation on the target namespace.