Thursday, 28 December 2017

1. Download MongoDB from here
2. Install the MongoDB using "Custom" and set the path to C:\MongoDB
3. After install is completed, open "Command Prompt" as "Administrator"
4. Issue the following command to create folder for databases and logs
    C:\MongoDB>md log
    C:\MongoDB>md data\db
5. Navigate to C:\MongoDB\Bin and run the following command
    mongod --directoryperdb --dbpath C:\MongoDB\data\db --logpath C:\MongoDB\log\mongo.log --logappend --rest --install
6. Run the service:
  C:\MongoDB\Bin>net start MongoDB
7. Type "mongo.exe" to open the shell
8. Useful commands:
cls : clear screen
show dbs : show the list of databases
use customers : create database 'customers' and switch to it
db : give the current database name
9. Assign role to database
db.createUser ({
user: "admin",
pwd: "admin",
roles: ["readWrite","dbAdmin"]
    });


MongoDB manual and reference: click here
MongoDB Download centre: click here


No comments:

Setup Windows Local Account without the Internet

During the Windows setup,  On the WiFi screen, press SHIFT + F10  or  FN + SHIFT + F10  This will open the command prompt window with admini...