Sitemap
riow

Publications are personal

Basic MongoDB Commands

Useful Commands for MongoDB

1 min readFeb 8, 2018

--

Press enter or click to view image in full size

GET ALL DATABASES

show dbs

GET ALL COLLECTIONS

mongo shell:

db.getCollectionNames()

node.js:

Get Rio Weber’s stories in your inbox

Join Medium for free to get updates from this writer.

db.listCollections()

bash:

show collections

EXPORT A COLLECTION

bash:

mongoexport --db DATABASE --collection NAME --out FILE_OUT.json

IMPORT A COLLECTION

bash:

mongoimport --db DATABASE --collection NAME < FILE_IN.json

--

--