1{
2 "description": "findOneAndReplace-hint",
3 "schemaVersion": "1.0",
4 "runOnRequirements": [
5 {
6 "minServerVersion": "4.3.1"
7 }
8 ],
9 "createEntities": [
10 {
11 "client": {
12 "id": "client0",
13 "observeEvents": [
14 "commandStartedEvent"
15 ]
16 }
17 },
18 {
19 "database": {
20 "id": "database0",
21 "client": "client0",
22 "databaseName": "crud-v2"
23 }
24 },
25 {
26 "collection": {
27 "id": "collection0",
28 "database": "database0",
29 "collectionName": "findOneAndReplace_hint"
30 }
31 }
32 ],
33 "initialData": [
34 {
35 "collectionName": "findOneAndReplace_hint",
36 "databaseName": "crud-v2",
37 "documents": [
38 {
39 "_id": 1,
40 "x": 11
41 },
42 {
43 "_id": 2,
44 "x": 22
45 }
46 ]
47 }
48 ],
49 "tests": [
50 {
51 "description": "FindOneAndReplace with hint string",
52 "operations": [
53 {
54 "object": "collection0",
55 "name": "findOneAndReplace",
56 "arguments": {
57 "filter": {
58 "_id": 1
59 },
60 "replacement": {
61 "x": 33
62 },
63 "hint": "_id_"
64 },
65 "expectResult": {
66 "_id": 1,
67 "x": 11
68 }
69 }
70 ],
71 "expectEvents": [
72 {
73 "client": "client0",
74 "events": [
75 {
76 "commandStartedEvent": {
77 "command": {
78 "findAndModify": "findOneAndReplace_hint",
79 "query": {
80 "_id": 1
81 },
82 "update": {
83 "x": 33
84 },
85 "hint": "_id_"
86 }
87 }
88 }
89 ]
90 }
91 ],
92 "outcome": [
93 {
94 "collectionName": "findOneAndReplace_hint",
95 "databaseName": "crud-v2",
96 "documents": [
97 {
98 "_id": 1,
99 "x": 33
100 },
101 {
102 "_id": 2,
103 "x": 22
104 }
105 ]
106 }
107 ]
108 },
109 {
110 "description": "FindOneAndReplace with hint document",
111 "operations": [
112 {
113 "object": "collection0",
114 "name": "findOneAndReplace",
115 "arguments": {
116 "filter": {
117 "_id": 1
118 },
119 "replacement": {
120 "x": 33
121 },
122 "hint": {
123 "_id": 1
124 }
125 },
126 "expectResult": {
127 "_id": 1,
128 "x": 11
129 }
130 }
131 ],
132 "expectEvents": [
133 {
134 "client": "client0",
135 "events": [
136 {
137 "commandStartedEvent": {
138 "command": {
139 "findAndModify": "findOneAndReplace_hint",
140 "query": {
141 "_id": 1
142 },
143 "update": {
144 "x": 33
145 },
146 "hint": {
147 "_id": 1
148 }
149 }
150 }
151 }
152 ]
153 }
154 ],
155 "outcome": [
156 {
157 "collectionName": "findOneAndReplace_hint",
158 "databaseName": "crud-v2",
159 "documents": [
160 {
161 "_id": 1,
162 "x": 33
163 },
164 {
165 "_id": 2,
166 "x": 22
167 }
168 ]
169 }
170 ]
171 }
172 ]
173}
View as plain text