mongoDB

1. Run mongoDB in Windows,

In command prompt, go to folder which include mongod.exe, then type: 

        mongod.exe --dbpath D:/mongoDB/db, and click enter.

If you can see

[initandlisten] MongoDB starting : pid=xxxx port=xxxxx dbpath=xxxxxxxx 32-bit.

That means mongoDB is running now. Then open a new command prompt , and type mongo.exe, you should see:

MongoDB shell version: x.x.x

connecting to: test 

MongoDB running successful. 

2.  mongoDB closed unexpectedly,

  If mongoDB close unexpected, when you want to run it again, you will see message like:

  ************

   old lock file: D:/mongoDB/db/mongod.lock. probably means unclean shutdown recommend removing file and running --repair

  ************

  We can repair this problem as message write. Remove file mongod.lock from D:/mongoDB/ and D:/mongoDB/db/, then run

  mongod.exe --repair

  OK, problem resloved.

原文地址:https://www.cnblogs.com/jiajinyi/p/mongoDB.html