mongodbHow to connect to MongoDB from bash?
You can connect to MongoDB from bash using the mongo command.
$ mongo
MongoDB shell version v4.2.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("f9f9f9f9-f9f9-f9f9-f9f9-f9f9f9f9f9f9") }
MongoDB server version: 4.2.3
The mongo command takes the following parameters:
--host: The hostname of the MongoDB instance.--port: The port of the MongoDB instance.--username: The username to authenticate with.--password: The password to authenticate with.--authenticationDatabase: The authentication database to use.
For more information, see the MongoDB documentation.
More of Mongodb
- How to use watch in MongoDB?
- How to use the limit operator in MongoDB?
- How to list all indexes in MongoDB?
- How to join two collections in MongoDB?
- How to use unwind in MongoDB?
- How to use triggers in MongoDB?
- How to query with "not in" condition in MongoDB?
- How to do text search in MongoDB?
- How to remove a field from MongoDB?
- How to use MongoDB query with "or" condition?
See more codes...