In a way, it's pretty similar to what we can do with MySQL's "RENAME TABLE" command:
db.runCommand({renameCollection:"sourcedb.mycol",to:"targetdb.mycol"})
In the background, MongoDB will dump and restore it automatically. There is no metadata "magic" for such a rename since databases reside in different files on disk. It just saves a bit of work, and it's worth knowing about.
Great thanks!
ReplyDeleteshould switch to use admin database before running this command, as described in:
https://jira.mongodb.org/browse/PHP-282
thanks!!!
ReplyDelete