Friday, May 3, 2013

First step with Mongo DB - A quick start


Download Mongo DB-

MongoDB on Windows

Local Database folder (default)-
C:\data\db

Start Mongo DB server
C:\mongodb\bin\mongod.exe –dbpath “C:\data\db








Mongo client on separate cmd window -
C:\mongodb\bin\mongo.exe


The value, if string, has to be in double quotes.

db.test.save()  - saves the value
db.test.find() – gives the value.

Mongo as Service on Windows Environment-
From  CMD prompt

md C:\mongodb\log
echo logpath=C:\mongodb\log\mongo.log > C:\mongodb\mongod.cfg
 
Install
C:\mongodb\bin\mongod.exe --config C:\mongodb\mongod.cfg –install
 
 
Run MongoDB as service –
net start MongoDB
 
To Stop-
net stop MongoDB
 
Remove-
C:\mongodb\bin\mongod.exe --remove


No comments:

Post a Comment