mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Fix autoReconnect Mongo URL addition
This commit is contained in:
@@ -21,10 +21,12 @@ _Mongo = function (url) {
|
||||
self._liveResultsSets = {};
|
||||
|
||||
// Set autoReconnect on Mongo URLs by default.
|
||||
var parsedUrl = urlModule.parse(url, true);
|
||||
if (!_.has(parsedUrl.query, 'autoReconnect'))
|
||||
parsedUrl.query.autoReconnect = 'true';
|
||||
url = urlModule.format(parsedUrl);
|
||||
if (!(/[\?&]autoReconnect/.test(url))) {
|
||||
if (/\?/.test(url))
|
||||
url += '&autoReconnect=true';
|
||||
else
|
||||
url += '?autoReconnect=true';
|
||||
}
|
||||
|
||||
MongoDB.connect(url, {db: {safe: true}}, function(err, db) {
|
||||
if (err)
|
||||
|
||||
Reference in New Issue
Block a user