Skip to content

Instantly share code, notes, and snippets.

@makitocode
Last active May 1, 2018 19:11
Show Gist options
  • Save makitocode/83ecc3ae7f8bc966eec1850530c5e81f to your computer and use it in GitHub Desktop.
Save makitocode/83ecc3ae7f8bc966eec1850530c5e81f to your computer and use it in GitHub Desktop.
Mongodb commands
$mongo // -> go to mongo shell
$show dbs // -> show dbs
$use DATABASE_NAME // -> go to DATABASE_NAME
//GET records from TABLE_NAME
$show tables // -> show tables on DATABASE_NAME
$db.TABLE_NAME.find().pretty() // -> Show records on TABLE_NAME as a json file
$db.TABLE_NAME.find() // -> show all records no pretty - just one line.
//DELETE all records from
$db.TABLE_NAME.drop() // -> delete records
$mongod // -> Start local mongo
$sudo service mongod start //-> Start mongo on ubuntu server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment