summaryrefslogtreecommitdiff
path: root/jstests/core/fts_dotted_prefix_fields.js
blob: 4f634c57312d7a8f4931f4bcf2f3f4b9bc5dfa06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Test that text search works correct when the text index has dotted paths as the non-text
// prefixes.
(function() {
"use strict";

let coll = db.fts_dotted_prefix_fields;
coll.drop();
assert.commandWorked(coll.createIndex({"a.x": 1, "a.y": 1, "b.x": 1, "b.y": 1, words: "text"}));
assert.commandWorked(
    coll.insert({a: {x: 1, y: 2}, b: {x: 3, y: 4}, words: "lorem ipsum dolor sit"}));
assert.commandWorked(
    coll.insert({a: {x: 1, y: 2}, b: {x: 5, y: 4}, words: "lorem ipsum dolor sit"}));

assert.eq(
    1,
    coll.find({$text: {$search: "lorem ipsum"}, "a.x": 1, "a.y": 2, "b.x": 3, "b.y": 4}).itcount());
}());