mongodbWhat is MongoDB default port?
MongoDB default port is 27017. It is the port on which MongoDB server listens for client connections.
Example code to connect to MongoDB server on default port:
mongo --host 127.0.0.1 --port 27017
Output of the above code:
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 code above connects to MongoDB server running on 127.0.0.1 (localhost) on port 27017.
Helpful links
More of Mongodb
- How to use watch in MongoDB?
- How to perform a health check for MongoDB?
- How to work with time series data in MongoDB?
- How to empty an array in MongoDB?
- How to insert new document into MongoDB?
- How to check the version of MongoDB?
- How to update an array element in MongoDB?
- How to set MongoDB oplog?
- How to drop a database in MongoDB?
- How to update one document in MongoDB?
See more codes...