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

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