You can use .findOne
to return a single instance and get the result.
Find assumes you're querying for a collection of documents and return a cursor:
You can for example, convert it to an array:
db.books.find({"number":1}, {"views":1, _id:0}).toArray(function(err, results){
console.log(results);
});
You can use .each
to iterate through elements and .nextObject
to get the next, they're all asynchronous obviously being IO operations in nodejs, here is the section on cursors in the manual.