Using cloneCollection in MongoDB: how to authenticate?
mongodb
Solution
Unfortunately that's currently not possible. There is a Jira ticket open for this feature. As a workaround you could consider using `mongodump --collection` and `mongorestore`.
Problem
I'm trying to clone a remotely hosted collection to my local Mongo database. I tried opening up the mongo console in the local environment and issued: ``` db.runCommand({cloneCollection: "<dbname.colname>", from: "<remotehost:port>"}) ``` It fails with ``` "errmsg" : "exception: nextSafe(): { $err: \"not authorized for query on <dbname>.system.namespaces\", code: 16550 }", "code" : 13106, ``` How do I properly authorize with the remote server to clone the collection?