mongo (command)

From wikieduonline
Jump to navigation Jump to search

https://docs.mongodb.com/manual/reference/program/mongo/

mongo --help
mongo
MongoDB shell version v4.2.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-04-12T11:29:06.534+0000 E  QUERY    [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-04-12T11:29:06.536+0000 F  -        [main] exception: connect failed
2020-04-12T11:29:06.536+0000 E  -        [main] exiting with code 1


  • mongo --eval "printjson(db.serverStatus())"
  • mongo < file_with_commands.txt
  • mongo --host IP_TO_CONNECT


Related commands[edit]

See also[edit]

Advertising: