What is the standard format for a MongoDB connection URI?

Responsive Ad Header

Question

Grade: Education Subject: Support
What is the standard format for a MongoDB connection URI?
Asked by:
57 Viewed 57 Answers

Answer (57)

Best Answer
(339)
A standard MongoDB connection URI generally follows the pattern: `mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[database][?options]]`. When using SRV records (like with MongoDB Atlas), the format is `mongodb+srv://[username:password@]host[/?options]`, where the 'host' itself contains the hostname, domain name, and TLD.