douwenan9849 2014-02-17 11:30
浏览 317
已采纳

连接到mongodb服务器时“无效的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.

  • 写回答

1条回答 默认 最新

  • doubi1910 2014-02-17 12:06
    关注

    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.

    For example, mine looks like

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

    Also make sure that collection name is legal.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 matlab计算中误差
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊