diff options
author | Jonathan Reams <jbreams@mongodb.com> | 2015-10-16 14:07:07 -0400 |
---|---|---|
committer | Jonathan Reams <jbreams@mongodb.com> | 2015-10-20 13:28:19 -0400 |
commit | acad0bb412888fbaadabe602a0f2602df430539b (patch) | |
tree | b4b46d793584b2248e0bee092774eff35bc2f036 /jstests/core | |
parent | 07168e0874ac9fe025b35d01d18659a0b62bb023 (diff) | |
download | mongo-acad0bb412888fbaadabe602a0f2602df430539b.tar.gz |
SERVER-8246 Add instanceof support for MinKey/MaxKey
Diffstat (limited to 'jstests/core')
-rw-r--r-- | jstests/core/type8.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/core/type8.js b/jstests/core/type8.js new file mode 100644 index 00000000000..246133b33d9 --- /dev/null +++ b/jstests/core/type8.js @@ -0,0 +1,18 @@ +(function(){ + "use strict"; + + // SERVER-8246 Min/MaxKey should be comparable + // + // make sure that the MinKey MaxKey JS types are comparable + + function testType(t1, t2) { + db.minmaxcmp.save({_id: t1}); + var doc = db.minmaxcmp.findOne({_id: t1}); + assert.eq(doc._id, t1, "Value for " + t1 + " did not round-trip to DB correctly"); + assert.neq(doc._id, t2, "Value for " + t1 + " should not equal " + t2); + assert(doc._id instanceof t1, "Value for " + t1 + "should be instance of" + t1); + assert(!(doc._id instanceof t2), "Value for " + t1 + "shouldn't be instance of" + t2); + } + testType(MinKey, MaxKey); + testType(MaxKey, MinKey); +})(); |