Friday, September 26, 2014

Starting MONGODB - NoSQL

I heard about MongoDB from a friend and wanted to try out open source database.

Installing Mongo DB

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/

I am installing MongoDB on windows 7. I have downloaded windows version from Mogodb website and unpacked msi.


  • move bin folder to C:\MogoDB\
  • create a directory for data - c:\data\db
  • Setting data path
  • c:\mongodb\bin\mongod.exe --dbpath c:\data\db





Starting MongoDB service

Open a command prompt

C:\MongoDB\Bin\Mongod.exe


Waiting for connections on port 27017 means MongoDB service is successfully started.



Open another command Prompt to connect to Mongo Database

Type

C:\mongodb\bin\Mongo.exe

You will see the error that cannot find the file mongorc.js



So you tell the shell to ignore looking for .mongorc.js

C:\MongoDB\Bin\Mongo.exe --norc --shell



Now you are successfully connected to database.

type 

db
it will return test, connecting to test database





use mydb


show collections



Generate test data in a loop


Read inserted data




It was fun to play with MongoDB. More posts will be coming soon...

No comments:

Post a Comment

How to add a Database to AlwaysOn Availability Group with four different options

To add a database to an existing AlwaysOn availability group, MS has given us four options to choose from Automatic seeding Full database an...