Skip to content

First contact with MongoDB


Although I use to work with relational databases, now it’s time to try NoSQL databases. I have though about it, and the chosen one is MongoDB.

The first step is download MongoDB from the official website:

First it calls my attentios is  …

you need the computer or server udated

… , especially if you are a Windows user, and also you can read that Windows XP is not supported. You can use it, but as a slave or for experiment (our case). I will use Windows 7 Home edition.

Installing MongoDB

The page introduction to MongoDB for Windows installations is very interesting. After reading a few indications about this particular operating system, I upzip de downloaded file on a directory, and I create a new one directory to store the data. You don’t need to install anything, just unzip the file!

Directorio de MongoDB

MongoDB Directory

Let’s open a command window and start the server with mongod.

Iniciando MongoDB

Initializing MongoDB

I got an error because I need to provide the data path. Now, I did it:

Inicializando mongoDB

Initializing mongoDB

I got a warning message related to Windows firewall, but I aswer that its a private network. In the documentation all this process is very well explained. If you work as a localhost, the default post is 27017. After allowing this post, the server is up and running. Easy!

I open a new command window, and move to the bin directory and I write “mongo“.

Instalando mongoDB

Instalando mongoDB

Now I have a new connection opened. To test that everything is working, I write:

  • To save a record:{ a: 1 } )
  • To ckeck it exists: db.test.find()
Probando mongoDB

Probando mongoDB

And … that’s all for my first MongoDb experience!

Manejando Datos Newsletter

Noticias, entradas, eventos, cursos, … News, entrances, events, courses, …

Gracias por unirte a la newsletter. Thanks for joining the newsletter.