Query with Nodejs

Pre-Requisites

This lesson expects that you read first the sections

  • Overview
  • Data Model

The hands-on activity is expected to be done in this Lesson. Therefore, as you read the sections above, simply focus on understanding the concepts.

For this lesson we will use the Node.js interface to MongoDB: node-mongodb-native.

In order to interact with MongoDB from Node.js, we will write scripts in files, and then will run those scripts with the node.js command. the command

node

Let’s open a file mongo01.js with a text editor and write on it

Exercises

  • Search for your favorite movie
  • Search for all the movies by the director of your favorite movie
  • Find how many movies are in the collection from before the year 2000