Blogroll

Thursday, August 9, 2012

Install mongodb for windows

Follow some below step:
1. Download lasted version at http://www.mongodb.org/downloads and choose right version for your computer.
2. Extract zip file to somewhere, For me is c:\bin\mongodb.
3.Create folder that save mongodb data, For me is c:\data 
4.Open cmd and type cd c:\bin\mongodb\bin
5.Continue and cmd and type mongod --dbpath c:\data to run mongodb as services (c:\data is folder that created before).
In this step, mongdb is running, Remember don't close cmd because it's running.
To do testing with mongDb, do below step:
6. If have no error appear, It mean you installed mongodb  as services successful. Next test it working.
7.Open cmd and type  cd c:\bin\mongodb\bin and type another text is mongo and enter. Mongo shell will be apper.
8. Type code to insert to db db.test.save({a:'abc'}) , It mean add a with value is 'abc' to test collection
9.To show record in test collection , type code db.test.find()

Nodejs with mongodb

Today, I excited to research nodeJs and i find way  how to access db to Mongodb from nodeJS.
At first, install module mongodb for node in this link