Tuesday, 8 March 2016

Configuring AngularJS and MongoDB on windows 7

Required tools :
1)      Babun/Cygwin 
2)      Node.js (can be downloaded here: http://nodejs.org/)
3)      Mongo DB (can be downloaded here:  http://www.mongodb.org/downloads)
4)      Express-generator
a.       $ pact install npm (if using babun)
b.      npm install express-generator –g   (To install express)
c.       express –h  (To display command options)
d.      express showtrackr  (creates an express app)
e.       Then install dependencies
                                                              i.      cd showtrackr
                                                            ii.      npm install
                                                          iii.      Run the app: npm start and

                                                          iv.      Hit http://localhost:3000/


Configuring MongoDB on windows 7

Ø  Cd to node_modules

Ø  node_modules> npm install mongodb
(we should have the node_modules/mongodb folder available)


Hotfix for mongodb is available here:


To start Mongo DB service:

Ø  Net start mdb27017    (27017- default mongoDB port)

Can be checked in windows services(Windows key-> search 'services'->Search for MongoDB Services as shown below )


NOTE: 

Check list/ solutions for errors during installation:

       i)    In the node_modules folder of our project folder, there should be mongodb folder, which confirms mongodb is installed.




    ii ) If we encounter below error:


    Then, 

      npm install -g node-gyp
     git clone https://github.com/mongodb/js-bson.git
     cd js-bson
     npm install
     node-gyp rebuild 
                         
                                                        or
    In the MongoDB/node_modules, search

 bson = require('../build/Release/bson');

 and in catch block change to

 bson = require('../browser_build/bson');


Note:  To start MongoDB

In windows cmd promt:
 cd to bin of MongoDB

Ø  Mongo.exe

Ø  Use <DBname>

Ø  Show < DBname >