在MongoDB中使用cloneCollection:如何进行身份验证? [英] Using cloneCollection in MongoDB: how to authenticate?

查看:158
本文介绍了在MongoDB中使用cloneCollection:如何进行身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将远程托管的集合克隆到我的本地Mongo数据库中.我尝试在本地环境中打开mongo控制台并发出:

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>"})

失败并显示

"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?

推荐答案

不幸的是,目前这是不可能的.为此功能打开了 Jira票证.作为解决方法,您可以考虑使用mongodump --collectionmongorestore.

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.

这篇关于在MongoDB中使用cloneCollection:如何进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆