summaryrefslogtreecommitdiff
path: root/jstests/sharding/resume_query_disallowed_on_mongos.js
blob: 46d1d9720fdf0156a69b37df51e8e71650e2d554 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
 * Test that trying to use $_resumeAfter and $_requestResumeToken options to resume a query fails
 * on mongos.
 * @tags: [
 *   multiversion_incompatible,
 * ]
 */

(function() {
"use strict";

const st = new ShardingTest({shards: 1});
const db = st.getDB("test");

// $_requestResumeToken is disallowed.
assert.commandFailedWithCode(
    db.runCommand({find: "test", hint: {$natural: 1}, batchSize: 1, $_requestResumeToken: true}),
    ErrorCodes.BadValue);

// Passing a $_resumeAfter token is disallowed.
assert.commandFailedWithCode(db.runCommand({
    find: "test",
    hint: {$natural: 1},
    batchSize: 1,
    $_resumeAfter: {$recordId: NumberLong(1)}
}),
                             ErrorCodes.BadValue);

// Passing both is disallowed.
assert.commandFailedWithCode(db.runCommand({
    find: "test",
    hint: {$natural: 1},
    batchSize: 1,
    $_requestResumeToken: true,
    $_resumeAfter: {$recordId: NumberLong(1)}
}),
                             ErrorCodes.BadValue);

st.stop();
})();