Interactive JavaScript shell for MongoDB. http://docs.mongodb.org/v2.2/mongo/ http://docs.mongodb.org/v2.2/reference/mongo-shell/
# Import a JSON document
mongoimport -d dbname -c collectionname --file input-file.json
# Import a 'JSON Lines' document (one JSON document per file) into MongoDB http://jsonlines.org/
mongoimport -d dbname -c collectionname --file input-file.jsonl
# Import a valid JSON document (in case we have several documents)
mongoimport --db <db-name> --collection <coll-name> --type json --file seed.json --jsonArray
# To run MongoDB just type:
mongod --dbpath ~/Development/MongoDB/db/
// cd <mongodb installation dir>
// ./bin/mongo
db // display database in use (default database: test)
show dbs // Show all databases
use <database> // select database to use
// Access a collection and use shell methods
show collections // show all collections for current database
db.<collection>.find()
db["3test"].find()
db.getCollection("3test").find()
db.<collection>.find().pretty()