diff options
author | Misha Tyulenev <misha@mongodb.com> | 2017-02-28 11:01:46 -0500 |
---|---|---|
committer | Misha Tyulenev <misha@mongodb.com> | 2017-02-28 17:10:02 -0500 |
commit | 6fe8c420da0c1071bfb8abfd7e936059d4977472 (patch) | |
tree | 1467f8c7a80c4626200241e076f43fcbdefdf8d5 /src/mongo/shell/assert.js | |
parent | c203a3be8076c4939011d03e958bc010422ac86d (diff) | |
download | mongo-6fe8c420da0c1071bfb8abfd7e936059d4977472.tar.gz |
SERVER-27773 add operationTime field to the command response
Diffstat (limited to 'src/mongo/shell/assert.js')
-rw-r--r-- | src/mongo/shell/assert.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/shell/assert.js b/src/mongo/shell/assert.js index 2ce8e1e3dce..946d7c82112 100644 --- a/src/mongo/shell/assert.js +++ b/src/mongo/shell/assert.js @@ -131,6 +131,23 @@ assert.neq = function(a, b, msg) { doassert("[" + a + "] != [" + b + "] are equal : " + msg); }; +assert.hasFields = function(o, arr, msg) { + var count = 0; + if (!Array.isArray(arr)) { + throw new Error("The second argument to assert.hasFields must be an array."); + } + + for (var field in result) { + if (arr.includes(field)) { + count += 1; + } + } + + if (count != arr.length) { + doassert("None of values from " + tojson(arr) + " was in " + tojson(o) + " : " + msg); + } +}; + assert.contains = function(o, arr, msg) { var wasIn = false; if (!Array.isArray(arr)) { |