The basics of MongoDB

Since MongoDB is largely powered by JavaScript, the Mongo shell acts as a JavaScript environment. In addition to being able to execute regular Mongo queries, you can also execute standard JavaScript statements. Most of the items mentioned earlier in the JavaScript primer apply directly to the Mongo shell as well.

In this next section, we will focus primarily on the various ways to perform standard create, read, update, delete (CRUD) operations via the Mongo shell.

The Mongo shell

To access the Mongo shell, simply execute mongo from any terminal. The Mongo shell requires the mongod server to be currently running and available on the machine, as the first thing it does is connect to the server. Use the following command to access ...

Get Web Development with MongoDB and NodeJS - Second Edition 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.