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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* Tests for an empty readConcern object, passed as not the first
* statement in a multi-statement transaction.
* @tags: [requires_replication, requires_sharding]
*/
(function() {
"use strict";
const lsid = {
id: UUID()
};
{
const rst = new ReplSetTest({nodes: 1});
rst.startSet();
rst.initiate();
const primary = rst.getPrimary();
const collection = primary.getCollection("test.mycoll");
assert.commandWorked(collection.insert({}));
const commandObj = {
find: collection.getName(),
lsid,
txnNumber: NumberLong(1),
autocommit: false,
};
assert.commandWorked(
collection.runCommand(Object.assign({}, commandObj, {startTransaction: true})));
assert.commandWorked(collection.runCommand(Object.assign({}, commandObj, {readConcern: {}})));
rst.stopSet();
}
{
const st = new ShardingTest({mongos: 1, config: 1, shards: 1, rs: {nodes: 1}});
const collection = st.s.getCollection("test.mycoll");
assert.commandWorked(collection.insert({}));
const commandObj = {
find: collection.getName(),
lsid,
txnNumber: NumberLong(1),
autocommit: false,
};
assert.commandWorked(
collection.runCommand(Object.assign({}, commandObj, {startTransaction: true})));
assert.commandWorked(collection.runCommand(Object.assign({}, commandObj, {readConcern: {}})));
st.stop();
}
})();
|