我只是玩 mongo shell 并遇到了Cannot use commands write mode, degrading to compatibility mode
.
我连接到远程 mongo 服务器(mongolab)并尝试通过我的简单脚本将新记录插入到集合中:
// script.js
db = connect(host + ":" + port +"/" + dbName);
db.auth(username, password);
db.test2.insert({ item: "card", qty: 15 });
我运行脚本mongo script.js
并得到:
MongoDB shell version: 2.6.3
connecting to: test
connecting to: my.mongolab.com:port/DBname
Cannot use commands write mode, degrading to compatibility mode
怎么了?此外,当我通过mongo my.mongolab.com:port/DBname -u <dbuser> -p <dbpassword>
一切正常连接后执行类似查询时。