Retrieving every member of a MongoDb collection in javascript?

I’m able to use the following code to retrieve a member from a database but it stops working when i change findOne() to find(). Why is that? How can I retrieve all items in db.collection(‘posts’)?

        db.collection('posts').findOne({}).then(result =>{
        	console.log(result);
        	return result;
        });

Mongodb find() method returns a cursor^^ You can use .toArray on result to display all the returned documents.

Mongo shell methods