CS代考 MongoDB Setup

MongoDB Setup
Install the MongoDB Community Server
https://www.mongodb.com/download-center#community
(Click the Community Server Tab)

Copyright By PowCoder代写 加微信 powcoder

Running MongoDB server
Make sure the /data/db folder exisits.
If it doesn’t exist, create the folder and make it writable.
On MAC, from a terminal window, type the following: sudo mkdir -p -m 777 /data/db
On Windows, create the folder C:\data\db
Open a terminal window, navigate to the “bin” folder of the MongoDB installation location, and run the following command to start the MongoDB server.

Running MongoDB client and Setting up Authorized Users
From a different terminal window, navigate to the “bin” folder of the MongoDB installation location, and run the following command to start the MongoDB client shell.
At the prompt within the client, type the following:
db.createUser(
user: “admin_user”,
pwd: “admin_secret”,
roles: [ { role: “userAdminAnyDatabase”, db: “admin” } ]
Stop the client that is running in this terminal window (CTRL-C).
Stop the server that is running in the other terminal window (CTRL-C).
Restart the server in the terminal window with the following command:
./mongod –auth
Restart the client in the terminal window with the following command:
./mongo -u “admin_user” -p “admin_secret” –authenticationDatabase “admin”
At the prompt within the client, type the following:
use cs602db
db.createUser(
user: “cs602_user”,
pwd: “cs602_secret”,
roles: [“readWrite”] }
The client can be stopped at this point. The server needs to be running.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com