Querying MongoDB collections


show more Querying MongoDB collections provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013) show less
please wait ...

Querying MongoDB collections

Once documents are entered into a Mongo DB collection, you can query them to display the data. Mongoose has functions for querying Mongo DB collections and handling the responses. In this video, we'll query the flights collection and display the results in a view. Lets go to the exercise files. Go to chapter seven, video three and then copy the start folder to your desktop. Next, let's install the dependencies. Change directory to that start folder and then type in npm install.

Then press Return. Now let's go to the code. Open the start folder in sublime text or any other text editor you prefer. Let's go to the routes index.js file. Let's create a new route handler called arrivals. Just like all the other route handlers, it's a function that accepts the request object and the response object as the two arguments. Now from the previous video, we included the flight schema from the schemas folders. We can use this flight schema to also query the mongo database.

The FlightSchema objec...

Querying MongoDB collections
Video duration: 5m 32s 3h 17m Intermediate

Viewers:

Querying MongoDB collections provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013)

Subject:
Developer
Software:
JavaScript Node.js
Author:
please wait ...