mongosh
A new shell for MongoDB, replacement for
mongo. Note: All connection options can be replaced with one string:mongodb://user@host:port/db_name?authSource=authdb_name. More information: https://www.mongodb.com/docs/mongodb-shell/.
- Connect to a local database on the default port (
mongodb://localhost:27017):
mongosh
- Connect to a database:
mongosh --host --port
- Authenticate using the specified username on the specified database (you will be prompted for a password):
mongosh --host --port --username --authenticationDatabase
- Evaluate a JavaScript expression on a database:
mongosh --eval ''
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
