1. Installation
Method 1:mac The computer is easy to install, directly download the required version of the decompression can:
Download URL
Https://www.mongodb.com/download-center?jmp=nav#community
Method 2:
Brew Install MongoDB
2. MongoDB data default exists/data/db, so need to create this folder
$ sudo mkdir-p/data/db #data with bin sibling
$ sudo chown xxx/data/db (sudo chown alan/data/db) # Set permissions with directory
Please replace XXX with your current user name, if you are unsure you can run $ whoami first
3. Set Environment variables:
Export Mongo_path=/usr/local/mongodb # According to the directory you have placed export path= $PATH: $MONGO _path/bin
4. Start MongoDB
$ mongod
5. Query Database
run in another terminal window
$ MONGO
You can then start various database directives, such as
$show DBS shows databases that already exist
$use somedbname Create (use) a database
6. Exit
$exit
Oruse admin
db.shutdownServer();
Mac using the Install MongoDB