Video Course

Create a CRUD App with Node and MongoDB: Lesson 12 of 17

Showing Real Events

Up Next

Creating Events

Autoplaying in 7 seconds!

Cancel

We'll use mongoose and the mongoose model we created to grab real events from our MongoDB database.

To grab events:

// grab all events, the {} matches all
Event.find({}, (err, events) => {

    console.log(events);

});

// grab a single event with the slug ping-pong
Event.findOne({ slug: 'ping-pong' }, (err, event) => {

    console.log(event);

});

Chris Sevilleja

162 posts

Co-founder of Scotch.io. Slapping the keyboard until something good happens.