Last active
May 1, 2018 19:11
-
-
Save makitocode/83ecc3ae7f8bc966eec1850530c5e81f to your computer and use it in GitHub Desktop.
Mongodb commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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