diff options
Diffstat (limited to 'jstests/core/fts_trailing_fields.js')
-rw-r--r-- | jstests/core/fts_trailing_fields.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/jstests/core/fts_trailing_fields.js b/jstests/core/fts_trailing_fields.js index 2c7f79b423d..3f46cd1b1b7 100644 --- a/jstests/core/fts_trailing_fields.js +++ b/jstests/core/fts_trailing_fields.js @@ -1,22 +1,22 @@ // Tests for predicates which can use the trailing field of a text index. (function() { - "use strict"; +"use strict"; - const coll = db.fts_trailing_fields; +const coll = db.fts_trailing_fields; - coll.drop(); - assert.commandWorked(coll.createIndex({a: 1, b: "text", c: 1})); - assert.writeOK(coll.insert({a: 2, b: "lorem ipsum"})); +coll.drop(); +assert.commandWorked(coll.createIndex({a: 1, b: "text", c: 1})); +assert.writeOK(coll.insert({a: 2, b: "lorem ipsum"})); - assert.eq(0, coll.find({a: 2, $text: {$search: "lorem"}, c: {$exists: true}}).itcount()); - assert.eq(1, coll.find({a: 2, $text: {$search: "lorem"}, c: null}).itcount()); - assert.eq(1, coll.find({a: 2, $text: {$search: "lorem"}, c: {$exists: false}}).itcount()); +assert.eq(0, coll.find({a: 2, $text: {$search: "lorem"}, c: {$exists: true}}).itcount()); +assert.eq(1, coll.find({a: 2, $text: {$search: "lorem"}, c: null}).itcount()); +assert.eq(1, coll.find({a: 2, $text: {$search: "lorem"}, c: {$exists: false}}).itcount()); - // An equality predicate on the leading field isn't useful, but it shouldn't cause any problems. - // Same with an $elemMatch predicate on one of the trailing fields. - coll.drop(); - assert.commandWorked(coll.createIndex({a: 1, b: "text", "c.d": 1})); - assert.writeOK(coll.insert({a: 2, b: "lorem ipsum", c: {d: 3}})); - assert.eq(0, coll.find({a: [1, 2], $text: {$search: "lorem"}}).itcount()); - assert.eq(0, coll.find({a: 2, $text: {$search: "lorem"}, c: {$elemMatch: {d: 3}}}).itcount()); +// An equality predicate on the leading field isn't useful, but it shouldn't cause any problems. +// Same with an $elemMatch predicate on one of the trailing fields. +coll.drop(); +assert.commandWorked(coll.createIndex({a: 1, b: "text", "c.d": 1})); +assert.writeOK(coll.insert({a: 2, b: "lorem ipsum", c: {d: 3}})); +assert.eq(0, coll.find({a: [1, 2], $text: {$search: "lorem"}}).itcount()); +assert.eq(0, coll.find({a: 2, $text: {$search: "lorem"}, c: {$elemMatch: {d: 3}}}).itcount()); }()); |