程序代写代做代考 2018/12/6 CS 411 (188 unread)

2018/12/6 CS 411 (188 unread)

https://piazza.com/class/jl5z3qwqna71lp?cid=794 1/1

note 70 views

Updated 1 day ago by Anonymous

Some tips about MongoDB on Mac
My environment: MacOS 10.14.1
 
Part1 install
1.download tgz file from  https://www.mongodb.com/download-center#community and put the file under the path ” /Users/username”
2.Uncompress the file and rename

$ cd  /Users/username
$ tar -zxvf mongodb-osx-ssl-x86_64-4.0.4.tgz
$sudo mv filename mongodb

3. update environment path (I skipped the step)
4. create the data directory

$sudo mkdir -p /data/db

you will see a folder named data under the root path:  Macintosh HD/data/db
 
5. give permission to the data folder

$sudo chown -R $USER /data/db 

this opreation is a risky, but we are just doing homework, so ignore this~
reference:  https://stackoverflow.com/questions/42446931/mongodb-exception-in-initandlisten-20-attempted-to-create-a-lock-file-on-a-rea
 
6. test

$ cd /Users/username/mongodb/bin
$ ./mongod

open a new terminal
 

$ cd /Users/username/mongodb/bin
$ ./mongo

MongoDB shell version v4.0.4
connecting to: mongodb://127.0.0.1:27017
Implicit session: session { “id” : UUID(“xxxxxxxxxxxxxxxxxxxxxxxxxxx”) }
MongoDB server version: 4.0.4
Server has startup warnings:
…………………There will be a lot of warning message, because we didn’t set admin and password, but we can just ignore this…
Then you are all set~
try some basic operations:

$ show dbs

admin   0.000GB
config  0.000GB
local   0.000GB
 
Part2 import csv file into Mongodb
remember open a new terminal !!!

$cd /Users/username/mongodb/bin
$./mongoimport –db hw5 –collection business –type csv –headerline –ignoreBlanks –file “the absolute path/business.csv”

 
 
 
 
 
 

hw5

~ An instructor ( ) thinks this is a good note  ~Abdu Alawini

followup discussions for lingering questions and comments

https://www.mongodb.com/download-center#community
https://stackoverflow.com/questions/42446931/mongodb-exception-in-initandlisten-20-attempted-to-create-a-lock-file-on-a-rea