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: www.mongodb.org/downloads.
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!
Let’s open a command window and start the server with mongod.
I got an error because I need to provide the data path. Now, I did it:
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“.
Now I have a new connection opened. To test that everything is working, I write:
- To save a record: db.test.save({ a: 1 } )
- To ckeck it exists: db.test.find()
And … that’s all for my first MongoDb experience!