Difficulty: Beginner
Estimated Time: 10 minutes

In this tutorial you will learn how to use MongoDB.

This is an interactive tutorial that will guide through the basics for working with MongoDB. Read the instructions and execute the commands in the linux shell on the right.

The teminal on the right is a preconfigured linux environment, with everything you need to run MongoDB. It can be used as a regular linux shell - just type in commands. To help you get started, we've included code blocks which you can click, and will be executed on the shell for you.

You can always refresh the browser and reload the tutorial if you somehow managed to mess up something. You will get a fresh clean environment.

While we recommend you to follow the tutorial, you are more than welcome to try out stuff for yourself - you have a fully funcitonal MongoDB to play with.


You've succedfully completed this basic MongoDB tutorial.

To read more about MongoDB: https://docs.mongodb.com/manual/

Some more tutorials:



If you really want to learn MongoDB, sign up to the MongoDB University:


MongoDB Tutorial

Step 1 of 10

Connecting to MongoDB

We already have MongoDB up and runing for you. It will take a couple of seconds for it to fire up. Once our MongoDB instance is up, you can type mongo in the shell, and can start querying the database.

You will see a bunch of warnings in the shell. This is because we have not tuned our MongoDb instance for production deployment. In the scope of this tutorial this is fine. Use cls to clear the screen.

Mongo shell is a utility that allows you to connect to the database, query it, and perform admistrative actions. By default it connects to a local mongod instance on port 27017. You can also use it to connect to remote databses.

To make sure we're up and running we'll check the version. Type version() to get the mongo shell version. Type db.version() to get the database version.