...
1description: "findOneAndDelete-comment"
2schemaVersion: "1.0"
3
4
5createEntities:
6 - client:
7 id: &client0 client0
8 observeEvents: [ commandStartedEvent ]
9 - database:
10 id: &database0 database0
11 client: *client0
12 databaseName: &database0Name crud-tests
13 - collection:
14 id: &collection0 collection0
15 database: *database0
16 collectionName: &collection0Name coll0
17
18initialData: &initialData
19 - collectionName: *collection0Name
20 databaseName: *database0Name
21 documents:
22 - { _id: 1 }
23 - { _id: 2 }
24
25tests:
26 - description: "findOneAndDelete with string comment"
27 runOnRequirements:
28 - minServerVersion: "4.4"
29 operations:
30 - name: findOneAndDelete
31 object: *collection0
32 arguments:
33 filter: &filter
34 _id: 1
35 comment: "comment"
36 expectResult:
37 _id: 1
38 expectEvents:
39 - client: *client0
40 events:
41 - commandStartedEvent:
42 command:
43 findAndModify: *collection0Name
44 query: *filter
45 remove: true
46 comment: "comment"
47 outcome: &outcome
48 - collectionName: *collection0Name
49 databaseName: *database0Name
50 documents:
51 - { _id: 2 }
52
53 - description: "findOneAndDelete with document comment"
54 runOnRequirements:
55 - minServerVersion: "4.4"
56 operations:
57 - name: findOneAndDelete
58 object: *collection0
59 arguments:
60 filter: *filter
61 comment: &comment { key: "value"}
62 expectResult:
63 _id: 1
64 expectEvents:
65 - client: *client0
66 events:
67 - commandStartedEvent:
68 command:
69 findAndModify: *collection0Name
70 query: *filter
71 remove: true
72 comment: *comment
73 outcome: *outcome
74
75 - description: "findOneAndDelete with comment - pre 4.4"
76 runOnRequirements:
77 - minServerVersion: "4.2.0" # findAndModify option validation was introduced in 4.2
78 maxServerVersion: "4.2.99"
79 operations:
80 - name: findOneAndDelete
81 object: *collection0
82 arguments:
83 filter: *filter
84 comment: "comment"
85 expectError:
86 isClientError: false
87 expectEvents:
88 - client: *client0
89 events:
90 - commandStartedEvent:
91 command:
92 findAndModify: *collection0Name
93 query: *filter
94 remove: true
95 comment: "comment"
96 outcome: *initialData
View as plain text