summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorAndrew Shuvalov <andrew.shuvalov@mongodb.com>2020-11-15 00:22:54 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-15 01:46:45 +0000
commitfe88fed31376d6e2dc95af46342fb3c87c164ab1 (patch)
treea5eef28d9370d8743dbf0186aebd52fb712e1074 /src/mongo/shell
parent828266b8c7b99e54aa172ccb89aadcdb7d1e6a37 (diff)
downloadmongo-fe88fed31376d6e2dc95af46342fb3c87c164ab1.tar.gz
SERVER-51599: Allow creating an SSLConnectionContext from in-memory certificates
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/check_log.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mongo/shell/check_log.js b/src/mongo/shell/check_log.js
index 925c5e57f2d..6e13c3ba2f8 100644
--- a/src/mongo/shell/check_log.js
+++ b/src/mongo/shell/check_log.js
@@ -76,6 +76,12 @@ checkLog = (function() {
allAttrMatch = false;
break;
}
+ } else if (obj.attr[attrKey] !== attrValue &&
+ typeof obj.attr[attrKey] == "object") {
+ if (!_deepEqual(obj.attr[attrKey], attrValue)) {
+ allAttrMatch = false;
+ break;
+ }
} else {
if (obj.attr[attrKey] !== attrValue) {
allAttrMatch = false;
@@ -247,6 +253,35 @@ checkLog = (function() {
return (Array.isArray(value) ? `[${serialized.join(',')}]` : `{${serialized.join(',')}}`);
};
+ // Internal helper to compare objects filed by field.
+ const _deepEqual = function(object1, object2) {
+ if (object1 == null || object2 == null) {
+ return false;
+ }
+ const keys1 = Object.keys(object1);
+ const keys2 = Object.keys(object2);
+
+ if (keys1.length !== keys2.length) {
+ return false;
+ }
+
+ for (const key of keys1) {
+ const val1 = object1[key];
+ const val2 = object2[key];
+ const areObjects = _isObject(val1) && _isObject(val2);
+ if (areObjects && !_deepEqual(val1, val2) || !areObjects && val1 !== val2) {
+ return false;
+ }
+ }
+
+ return true;
+ };
+
+ // Internal helper to check that the argument is a non-null object.
+ const _isObject = function(object) {
+ return object != null && typeof object === 'object';
+ };
+
return {
getGlobalLog: getGlobalLog,
checkContainsOnce: checkContainsOnce,