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.

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

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥20 sim800c模块 at指令及平台
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计