Created
October 3, 2014 11:12
-
-
Save PythonicNinja/ba62dcfc62f7fe3f3856 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
mongod --path | |
mkdir -p /data/db | |
db.help() | |
-- shows databases | |
show dbs | |
-- shows collections | |
show collections | |
-- delete | |
db.canada.drop() | |
-- change databse | |
use xxx | |
-- inserts | |
db.jobes.insert({text: "Hi!"}); | |
db.jobes.insert({text: "Hej!", stars: -1}); | |
-- query | |
db.jobes.find() | |
db.jobes.findOne() | |
db.jobes.find({text: /!$/}) | |
db.jobes.find({province: "BC"}).count() | |
db.jobes.find({province: "BC"}).explain() | |
-- delete | |
db.jobes. | |
-- import | |
mongoimport --help | |
mongoimport --type csv --headerline doc/CSV/products/breuninger_july_complete_utf8.csv -c products | |
-- export | |
mongoexport -c products > products.json | |
head -l products.json | jq | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment