summaryrefslogtreecommitdiff
path: root/jstests/core/stages_text.js
blob: 077416b98afef307128600dee5416f556e352621 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Test very basic functionality of text stage

t = db.stages_text;
t.drop();
var collname = "stages_text";

t.save({x: "az b x"})

t.ensureIndex({x: "text"})

// We expect to retrieve 'b'
res = db.runCommand({stageDebug: {collection: collname,
                                  plan: {text: {args: {search: "b"}}}}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, 1);

// I have not been indexed yet.
res = db.runCommand({stageDebug: {collection: collname,
                                  plan: {text: {args: {search: "hari"}}}}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, 0);