summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/fle2_shardsvr_compact.js
blob: 7f5aa2cc5bf8bfd765321960d133dea4ce2c8c6c (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
/**
 * Cannot run compact against a shard server
 *
 * @tags: [
 * requires_fcv_60,
 * requires_sharding
 * ]
 */
load("jstests/fle2/libs/encrypted_client_util.js");

(function() {
'use strict';

function runTest(mongosConn, shardConn) {
    let dbName = 'testdb';

    let clientMongoS = new EncryptedClient(mongosConn, dbName);

    assert.commandWorked(clientMongoS.createEncryptionCollection("basic", {
        encryptedFields: {
            "fields":
                [{"path": "first", "bsonType": "string", "queries": {"queryType": "equality"}}]
        }
    }));

    let clientShard = new EncryptedClient(shardConn, dbName);

    assert.commandFailedWithCode(clientShard.getDB().basic.compact(), 6583201);
}

jsTestLog("Sharding: Testing fle2 drop collection warning");
{
    const st = new ShardingTest({shards: 1, mongos: 1, config: 1});

    runTest(st.s, st.shard0);

    st.stop();
}
}());