xbrowsersync / api

Server-side REST API that serves requests from xBrowserSync client apps
GNU General Public License v3.0
796 stars 83 forks source link

Support for MongoDB 3.6+ DNS Seedlist Connection Format (SRV) #20

Closed tlindsay42 closed 5 years ago

tlindsay42 commented 5 years ago

reference: https://docs.mongodb.com/manual/reference/connection-string/

It would be nice to have an option for using either the standard or new MongoDB DNS Seedlist Connection Format. Per the documentation, the key benefit is:

Using DNS to construct the available servers list allows more flexibility of deployment and the ability to change the servers in rotation without reconfiguring clients.

The simple workaround is to update the connection string in src/core/db.ts, but it would be nice to have a Boolean option in settings.json.

nero120 commented 5 years ago

@tlindsay42 I can't seem to find any info on docs.mongodb.com specifying the complete list of url options for a seedlist connection string. If you have an environment set up for this, can you tell me if this is a valid connection string format:

mongodb+srv://mongodb.myhost.com/xbrowsersync?username=xbrowsersyncdb&password=xbrowsersync&authSource=admin

Specifically, can I still specify the database name in the connection string, I think username and password are valid as querystring params...

Edit: don't worry, I found a valid example on this blog post.

tlindsay42 commented 5 years ago

If you spin up a dev cluster in MongoDB Atlas, you can test there for free. I haven't tested DocumentDB just yet.

nero120 commented 5 years ago

Ah cool, I'll look into it.