mongodb basic access commands

Shell into mongodb shell, mongo will use the default host localhost and default port 27017, or you can specify the host and port.

mongo
mongo -host localhost --port 27018

Importing a collection data from a csv file with headers in the first line.

mongoimport --type csv --headerline somedata.csv -d somedata -c data

Show databases, select database to use, and show collections in the database.

show dbs;
use somedatabase;
show collections;

Shutdown mongodb gracefully

use admin;
db.shutdownServer();
exit;

Start mongodb

mongod

Install and set up monogdb on mac.

Search within Codexpedia

Custom Search

Search the entire web

Custom Search