thameera
thameera

Reputation: 9473

Using cloneCollection in MongoDB: how to authenticate?

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?

Upvotes: 8

Views: 1744

Answers (1)

Bruce Lucas
Bruce Lucas

Reputation: 959

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.

Upvotes: 8

Related Questions