Find query for MongoDB in node.js -


i have following query oids array of object id's.

users.find({ _id: { $in: oids } }, function(err, result){     console.log(result); });  

i expect list of users id users in array of object id's, actual result looks this:

{ db: { databasename: 'users', serverconfig: { _callbackstore: [object], host: 'localhost', port: 27017, options: [object], internalmaster: true, connected: true, poolsize: 5, disabledriverbsonsizecheck: false, slaveok: undefined, _used: true, replicasetinstance: null, ssl: false, sslvalidate: false, sslca: null, sslcert: undefined, sslkey: undefined, sslpass: undefined, _readpreference: null, socketoptions: [object], logger: [object], eventhandlers: [object], _serverstate: 'connected', _state: [object], recordquerystats: false, db: [circular], dbinstances: [object], connectionpool: [object], ismasterdoc: [object] }, options: { w: 1 }, _applicationclosed: false, native_parser: undefined, bsonlib: { code: [function: code], symbol: [function: symbol], bson: [object], dbref: [function: dbref], binary: [object], objectid: [object], long: [object], timestamp: [object], double: [function: double], minkey: [function: minkey], maxkey: [function: maxkey] }, bson: {} ... , on ...

if use user.findone(...) result expected user, query users in array.

find() method returns cursor, 'result' printing cursor details. guess have like:

collection.find().toarray(function(err, results) {      test.assertequals(1, results.length); }); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -