0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/core/jssymbol.js
Max Hirschhorn 071065a296 SERVER-25156 Add support for building v=2 indexes.
We use index version v=2 as the default index version when the
featureCompatibilityVersion is 3.4, and we use index version v=1 as the
default index version when the featureCompatibilityVersion is 3.2.

The "collation" index option can only be used with v=2 indexes.
2016-09-07 17:37:46 -04:00

32 lines
947 B
JavaScript

// Test Symbol.toPrimitive works for DB and BSON objects
//
(function() {
// Exercise Symbol.toPrimitive on DB objects
assert(`${db}` === 'test');
assert(isNaN(+db));
// Exercise the special Symbol methods and make sure DB.getProperty handles them
assert(db[Symbol.iterator] != 1);
assert(db[Symbol.match] != 1);
assert(db[Symbol.species] != 1);
assert(db[Symbol.toPrimitive] != 1);
// Exercise Symbol.toPrimitive on BSON objects
col1 = db.jssymbol_col;
col1.insert({});
a = db.getCollection("jssymbol_col").getIndexes()[0];
assert(isNaN(+a));
assert(+a.v >= 1);
assert(`${a.v}` >= 1);
assert(`${a}` == '[object BSON]');
// Exercise the special Symbol methods and make sure BSON.resolve handles them
assert(db[Symbol.iterator] != 1);
assert(db[Symbol.match] != 1);
assert(db[Symbol.species] != 1);
assert(db[Symbol.toPrimitive] != 1);
col1.drop();
})();