【发布时间】:2014-09-02 22:01:37
【问题描述】:
我正在使用 Node.js 程序将数据插入 MongoDB 数据库。我已将数据插入名为“repl-failOver”的集合中。
var mongoClient = require("mongodb").MongoClient;
mongoClient.connect("mongodb://localhost:30002/test", function(err, db) {
if (err) throw err;
db.collection("repl-failOver").insert( { "documentNumber" : document++}, function (err, doc) {
if (err) throw err;
console.log(doc);
});
db.close();
});
当我使用 Mongo shell 并使用 show collections 列出数据库中的集合时,我能够看到集合“repl-failOver”。
如何在 mongo shell 中为此集合运行查找命令?
【问题讨论】:
标签: mongodb collections