diff --git a/lib/core/sdam/server_description.js b/lib/core/sdam/server_description.js index 45310a4063..41a5cf5b72 100644 --- a/lib/core/sdam/server_description.js +++ b/lib/core/sdam/server_description.js @@ -19,6 +19,13 @@ const WRITABLE_SERVER_TYPES = new Set([ ServerType.Mongos ]); +const DATA_BEARING_SERVER_TYPES = new Set([ + ServerType.RSPrimary, + ServerType.RSSecondary, + ServerType.Mongos, + ServerType.Standalone +]); + const ISMASTER_FIELDS = [ 'minWireVersion', 'maxWireVersion', @@ -99,6 +106,13 @@ class ServerDescription { return this.type === ServerType.RSSecondary || this.isWritable; } + /** + * @return {Boolean} Is this server data bearing + */ + get isDataBearing() { + return DATA_BEARING_SERVER_TYPES.has(this.type); + } + /** * @return {Boolean} Is this server available for writes */