blob: 8f3738f47005ef1129629c2c1763dcf39bb1972a (
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
|
/**
* Test that mongoS rejects change streams which request 'fullDocumentBeforeChange' pre-images.
*
* @tags: [uses_change_streams, requires_replication]
*/
(function() {
'use strict';
const st = new ShardingTest({
shards: 1,
mongos: 1,
config: 1,
});
const shard = st.shard0;
const mongos = st.s;
// Test that we cannot create a collection with pre-images enabled in a sharded cluster.
assert.commandFailed(shard.getDB("test").runCommand({create: "test", recordPreImages: true}));
// Test that attempting to run $changeStream with {fullDocumentBeforeChange: "whenAvailable"} fails.
assert.commandFailedWithCode(mongos.getDB("test").runCommand({
aggregate: 1,
pipeline: [{$changeStream: {fullDocumentBeforeChange: "whenAvailable"}}],
cursor: {}
}),
51771);
// Test that attempting to run $changeStream with {fullDocumentBeforeChange: "required"} fails.
assert.commandFailedWithCode(mongos.getDB("test").runCommand({
aggregate: 1,
pipeline: [{$changeStream: {fullDocumentBeforeChange: "required"}}],
cursor: {}
}),
51771);
st.stop();
}());
|