3

When I try to clone my mongo database from other machine, I see the following on client

 db.cloneDatabase('10.10.124.110')
{ "errmsg" : "query failed staging.system.namespaces", "ok" : 0 }

and on server I see

Thu Nov 10 11:29:01 [conn10] assertion 10057 unauthorized db:staging lock type:-1 client:10.10.124.110 ns:staging.system.namespaces query:{}

How can I resolve this issue?

2 Answers 2

2

That error seems a lot like this one https://jira.mongodb.org/browse/SERVER-2846 where an error is thrown because copyDatabase() ... which cloneDatabase() uses ... requires Admin privileges. In that case the user is using a hosted MongoDB instance where they didn't have admin privileges.

You can see some more about how to use the copyDatabase() command here and here.

So, for example if you are using -auth a username/password you'll need to run the copyDatabase() command like this:

> db.copyDatabase(from_db, to_db, from_host, username, password);
Sign up to request clarification or add additional context in comments.

Comments

2

I was able to just resolve this error by querying the PRIMARY host in a replicaSet, rather than the SECONDARY.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.