summaryrefslogtreecommitdiff
path: root/jstests/core/stages_text.js
blob: 50182b04bb4d9ce366e30f0864f36df78ab5f21b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// @tags: [
//   does_not_support_stepdowns,
//   uses_testing_only_commands,
// ]

// 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);