“无效的ns";连接到mongodb服务器时 [英] "Invalid ns" when connecting to mongodb server

查看:251
本文介绍了“无效的ns";连接到mongodb服务器时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到我为一个正在进行的小项目设置的MongoLabs mongodb服务器.从本地计算机连接时,我可以很好地连接,但是当我尝试从Mediatemple服务器建立连接时,出现"Invalid ns"错误:

Im trying to connect to a MongoLabs mongodb server I setup for a small project Im working on. I can connect fine when connecting from my local machine, but when I try to make a connection from my Mediatemple server I get a 'Invalid ns' error:

Unable to connect to MongoDB: Failed to connect to: dsXXXXXX.mongolab.com:27769: send_package: the query returned a failure: Invalid ns [XXXXXX_dev/XXXXXX_dev.$cmd] (code: 16256)

有关如何解决此问题的任何建议将对您大有帮助.

Any suggestions on how to fix this would be a major help.

推荐答案

也许您的数据库名称在您的连接字符串或集合名称中(

Perhaps your database name in your connection string or collection name (together they make a namespace) have special characters, and they make the namespace name illegal.

因此,请确保您的连接字符串正确.

So you should make sure your connection string is ok.

例如,我的模样

mongodb://mydblogin:mydbpassword@ds044444.mongolab.com:44444/mydatabase

还要确保集合名称合法.

Also make sure that collection name is legal.

这篇关于“无效的ns";连接到mongodb服务器时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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