MongoDb查找给出奇怪的响应的查询

我正在尝试用nodejs在mongodb中search数据。 这是我的查询

collection.find({ age: { '$gt': 20 } }); 

它在robomongo工作得很好,但在我的申请中给了我这个回应

 Readable { pool: null, server: null, disconnectHandler: { s: { storedOps: [], storeOptions: [Object], topology: [Object] }, length: [Getter] }, bson: {}, ns: 'versioncontrol.Branch/contacts', cmd: { find: 'versioncontrol.Branch/contacts', limit: 0, skip: 0, query: { age: [Object] }, slaveOk: true, readPreference: { preference: 'primary', tags: undefined, options: [Object] } } 

现在我不知道如何从中得到我的数据。

从find方法返回的游标是可读的stream。 你已经从它读取的项目,以获得实际的结果。 看这个

例:

 var cursor = collection.find({ age: { '$gt': 20 } }); cursor.each(function (err, doc) { if (err) { console.log(err); } else { console.log('Fetched:', doc); } }); 

完成它使用

 var cursor = collection.find({ age: { '$gt': 20 } }).toArray(); cursor.then(function (docs) { console.log( docs ); });