返回的信息较少,为什么MongoDB中比db.collection.find[1]
db.collection.findOne()
回报较少的信息为什么db.collection.findOne()比db.collection.find [1]在MongoDB中
我想在MongoDB中的所有返回一个文档,但是当我运行的命令有使用findOne方法
返回的信息较少,为什么MongoDB中比db.collection.find[1]
db.collection.findOne()
回报较少的信息为什么db.collection.findOne()比db.collection.find [1]在MongoDB中
我想在MongoDB中的所有返回一个文档,但是当我运行的命令有使用findOne方法
一些信息丢失,您应该使用db.collection.find()[1]
如果您正在使用db.collection.find
(不含括号)将返回what a function is doing
样本输出为db.collection.find
(没有括号)。
function (query, fields, limit, skip, batchSize, options) {
var cursor = new DBQuery(this._mongo, this._db, this, this._fullName, this._massageObject(query), fields, limit, skip, batchSize, options || this.getQueryOptions());
var connObj = this.getMongo();
var readPrefMode = connObj.getReadPrefMode();
if (readPrefMode != null) {
cursor.readPref(readPrefMode, connObj.getReadPrefTagSet());
}
return cursor;
}
哦,我现在明白了,谢谢 – 2014-12-03 08:30:58
是你的'db.collection.find [1]'工作吗? – Yogesh 2014-12-02 08:01:25
对不起语法错误,我应该使用db.collection.find()[1] – 2014-12-03 08:29:49