...
1# Test that setting a default write concern does not add a write concern
2# to the command sent over the wire.
3# Test operations that require 3.2+ server, where findAndModify started
4# to accept a write concern.
5
6data:
7 - {_id: 1, x: 11}
8 - {_id: 2, x: 22}
9collection_name: &collection_name default_write_concern_coll
10database_name: &database_name default_write_concern_db
11
12runOn:
13 - minServerVersion: "3.2"
14
15tests:
16 - description: 'findAndModify operations omit default write concern'
17 operations:
18 - name: findOneAndUpdate
19 object: collection
20 collectionOptions: {writeConcern: {}}
21 arguments:
22 filter: {_id: 1}
23 update: {$set: {x: 1}}
24 - name: findOneAndReplace
25 object: collection
26 collectionOptions: {writeConcern: {}}
27 arguments:
28 filter: {_id: 2}
29 replacement: {x: 2}
30 - name: findOneAndDelete
31 object: collection
32 collectionOptions: {writeConcern: {}}
33 arguments:
34 filter: {_id: 2}
35 outcome:
36 collection:
37 name: *collection_name
38 data:
39 - {_id: 1, x: 1}
40 expectations:
41 - command_started_event:
42 command:
43 findAndModify: *collection_name
44 query: {_id: 1}
45 update: {$set: {x: 1}}
46 writeConcern: null
47 - command_started_event:
48 command:
49 findAndModify: *collection_name
50 query: {_id: 2}
51 update: {x: 2}
52 writeConcern: null
53 - command_started_event:
54 command:
55 findAndModify: *collection_name
56 query: {_id: 2}
57 remove: true
58 writeConcern: null
View as plain text