The legacy MongoDB shell. See
mongoshfor the new shell. Note: all connection options can be replaced with one string:mongodb://user@host:port/db_name?authSource=authdb_name. More information: https://docs.mongodb.com/manual/reference/program/mongo.
mongodb://localhost:27017):mongo
mongo --host host --port port db_name
mongo --host host --port port --username username --authenticationDatabase authdb_name db_name
mongo --eval 'JSON.stringify(db.foo.findOne())' db_name