Answer the question
In order to leave comments, you need to log in
How to copy mongo database from server using pymongo?
Hello.
Created a user at the base "admin" in mongo. I pointed out to him all the rights that I found. mongo version 2.4.9
{
"_id" : ObjectId("5565d4b0e2cb3c06a51bc810"),
"user" : "root2",
"pwd" : "83649f9cf3fc01bd7dce347baf12e838",
"roles" : [
"read",
"readWrite",
"dbAdmin",
"userAdmin",
"clusterAdmin",
"readAnyDatabase",
"readWriteAnyDatabase",
"userAdminAnyDatabase",
"dbAdminAnyDatabase"
]
}
import pymongo
from pymongo import MongoClient
client2 = MongoClient('52.74.52.245', 27017)
client2.admin.authenticate('root2', 'password')
print(client2.shoppr_db.collection_names())
client = MongoClient()
client.admin.command(
'copydb',
fromdb='shoppr_db',
todb='del4',
fromhost='52.74.59.245',
username='root2',
key='83649f9cf3fc01bd7cce347baf22e838'
)
,,,on namespace admin.$cmd failed: exception: nextSafe(): { $err: "not authorized for query on shoppr_db.system.namespaces", code: 16550 }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question