The find method

In Atom, what we're going to do is access the collection, just like we did inside of the mongodb-connect file using db.collection, passing in the collection name as the string. This collection is going to be the Todos collection. Now, we're going to go ahead and use a method available on collections called find. By default, we can call find with no arguments:

db.collection('Todos').find();

This means we're not providing a query, so we're not saying we want to fetch all Todos that are completed or not completed. We're just saying we want to fetch all Todos: everything, regardless of its values. Now, calling find is only the first step. find returns a MongoDB cursor, and this cursor is not the actual documents themselves. There ...

Get Advanced Node.js Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.