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.
[code language=”shell”]
mongo
mongo -host localhost –port 27018
[/code]

Importing a collection data from a csv file with headers in the first line.
[code language=”shell”]
mongoimport –type csv –headerline somedata.csv -d somedata -c data
[/code]

Show databases, select database to use, and show collections in the database.
[code language=”javascript”]
show dbs;
use somedatabase;
show collections;
[/code]

Shutdown mongodb gracefully
[code language=”javascript”]
use admin;
db.shutdownServer();
exit;
[/code]

Start mongodb
[code language=”shell”]
mongod
[/code]

Install and set up monogdb on mac.

Search within Codexpedia

Custom Search

Search the entire web

Custom Search