From 9c3b5ab4668adda9cdf054468c3cbdab3a8040ae Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Sat, 21 Apr 2018 21:04:19 -0400 Subject: [PATCH] fix(sdam): we can't use Array.includes yet --- lib/sdam/server_description.js | 4 +++- lib/uri_parser.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sdam/server_description.js b/lib/sdam/server_description.js index c64cc18b8..4e80e343c 100644 --- a/lib/sdam/server_description.js +++ b/lib/sdam/server_description.js @@ -66,7 +66,9 @@ class ServerDescription { * @return {Boolean} Is this server available for writes */ get isWritable() { - return [ServerType.RSPrimary, ServerType.Standalone, ServerType.Mongos].includes(this.type); + return ( + [ServerType.RSPrimary, ServerType.Standalone, ServerType.Mongos].indexOf(this.type) !== -1 + ); } } diff --git a/lib/uri_parser.js b/lib/uri_parser.js index a4d3f75e2..8e0676fd6 100644 --- a/lib/uri_parser.js +++ b/lib/uri_parser.js @@ -109,7 +109,7 @@ function parseSrvConnectionString(uri, options, callback) { record = record[0]; record = record.length > 1 ? record.join('') : record[0]; - if (!record.includes('authSource') && !record.includes('replicaSet')) { + if (record.indexOf('authSource') === -1 && record.indexOf('replicaSet') === -1) { return callback( new MongoParseError('Text record must only set `authSource` or `replicaSet`') );