summaryrefslogtreecommitdiff
path: root/jstests/core/fts6.js
blob: 7216fc728e97ea297087e2aab5bb7708b332c4c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// SERVER-13039. Confirm that we return the right results when $text is
// inside an $or.
// @tags: [
//   sbe_incompatible,
// ]

var t = db.jstests_fts6;
t.drop();

t.ensureIndex({a: 1});
t.ensureIndex({b: "text"});

t.save({_id: 1, a: 0});
t.save({_id: 2, a: 0, b: "foo"});

var cursor = t.find({a: 0, $or: [{_id: 2}, {$text: {$search: "foo"}}]});
var results = cursor.toArray();
assert.eq(1, results.length, "unexpected number of results");
assert.eq(2, results[0]["_id"], "unexpected document returned");