mongo 2.4.0.rc0 → 2.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -2
- data/lib/mongo/bulk_write/validatable.rb +3 -1
- data/lib/mongo/client.rb +30 -3
- data/lib/mongo/cluster/app_metadata.rb +7 -2
- data/lib/mongo/collection.rb +3 -1
- data/lib/mongo/collection/view.rb +3 -1
- data/lib/mongo/collection/view/aggregation.rb +3 -1
- data/lib/mongo/collection/view/builder/find_command.rb +20 -5
- data/lib/mongo/collection/view/map_reduce.rb +3 -1
- data/lib/mongo/collection/view/writable.rb +12 -2
- data/lib/mongo/cursor/builder/get_more_command.rb +3 -2
- data/lib/mongo/error/closed_stream.rb +1 -1
- data/lib/mongo/error/invalid_server_preference.rb +1 -1
- data/lib/mongo/index/view.rb +3 -1
- data/lib/mongo/operation/write/bulk/mergable.rb +1 -1
- data/lib/mongo/operation/write/create_index.rb +1 -1
- data/lib/mongo/operation/write/delete.rb +1 -1
- data/lib/mongo/operation/write/update.rb +1 -1
- data/lib/mongo/protocol/delete.rb +4 -1
- data/lib/mongo/protocol/get_more.rb +4 -1
- data/lib/mongo/protocol/insert.rb +7 -3
- data/lib/mongo/protocol/kill_cursors.rb +4 -1
- data/lib/mongo/protocol/message.rb +5 -1
- data/lib/mongo/protocol/query.rb +11 -4
- data/lib/mongo/protocol/update.rb +4 -1
- data/lib/mongo/server/connectable.rb +8 -2
- data/lib/mongo/server/connection_pool.rb +3 -1
- data/lib/mongo/server/monitor.rb +1 -0
- data/lib/mongo/socket.rb +16 -8
- data/lib/mongo/socket/ssl.rb +24 -9
- data/lib/mongo/uri.rb +6 -6
- data/lib/mongo/version.rb +1 -1
- data/mongo.gemspec +1 -1
- data/spec/mongo/bulk_write_spec.rb +117 -0
- data/spec/mongo/collection/view/aggregation_spec.rb +26 -0
- data/spec/mongo/collection/view/builder/find_command_spec.rb +244 -2
- data/spec/mongo/collection/view/map_reduce_spec.rb +13 -0
- data/spec/mongo/collection/view/readable_spec.rb +26 -0
- data/spec/mongo/collection/view/writable_spec.rb +104 -0
- data/spec/mongo/collection/view_spec.rb +13 -0
- data/spec/mongo/collection_spec.rb +226 -7
- data/spec/mongo/crud_spec.rb +5 -5
- data/spec/mongo/index/view_spec.rb +53 -0
- data/spec/mongo/server/connection_spec.rb +45 -26
- data/spec/mongo/socket/ssl_spec.rb +358 -22
- data/spec/spec_helper.rb +4 -0
- data/spec/support/authorization.rb +3 -3
- data/spec/support/certificates/client_cert.pem +21 -0
- data/spec/support/certificates/client_key.pem +28 -0
- data/spec/support/certificates/client_key_encrypted.pem +30 -0
- data/spec/support/crud.rb +67 -22
- data/spec/support/crud/read.rb +18 -36
- data/spec/support/crud/write.rb +0 -44
- data/spec/support/crud_tests/read/aggregate-collation.yml +17 -0
- data/spec/support/crud_tests/read/aggregate-out.yml +28 -0
- data/spec/support/crud_tests/read/aggregate.yml +1 -35
- data/spec/support/crud_tests/read/count-collation.yml +15 -0
- data/spec/support/crud_tests/read/count.yml +3 -15
- data/spec/support/crud_tests/read/distinct-collation.yml +17 -0
- data/spec/support/crud_tests/read/distinct.yml +1 -14
- data/spec/support/crud_tests/read/find-collation.yml +15 -0
- data/spec/support/crud_tests/read/find.yml +1 -12
- data/spec/support/crud_tests/write/deleteMany-collation.yml +22 -0
- data/spec/support/crud_tests/write/deleteMany.yml +1 -23
- data/spec/support/crud_tests/write/deleteOne-collation.yml +22 -0
- data/spec/support/crud_tests/write/deleteOne.yml +1 -21
- data/spec/support/crud_tests/write/findOneAndDelete-collation.yml +23 -0
- data/spec/support/crud_tests/write/findOneAndDelete.yml +2 -28
- data/spec/support/crud_tests/write/findOneAndReplace-collation.yml +24 -0
- data/spec/support/crud_tests/write/findOneAndReplace-upsert.yml +47 -0
- data/spec/support/crud_tests/write/findOneAndReplace.yml +13 -53
- data/spec/support/crud_tests/write/findOneAndUpdate-collation.yml +27 -0
- data/spec/support/crud_tests/write/findOneAndUpdate.yml +8 -51
- data/spec/support/crud_tests/write/insertMany.yml +1 -2
- data/spec/support/crud_tests/write/insertOne.yml +1 -2
- data/spec/support/crud_tests/write/replaceOne-collation.yml +23 -0
- data/spec/support/crud_tests/write/replaceOne-upsert.yml +48 -0
- data/spec/support/crud_tests/write/replaceOne.yml +11 -45
- data/spec/support/crud_tests/write/updateMany-collation.yml +27 -0
- data/spec/support/crud_tests/write/updateMany.yml +10 -42
- data/spec/support/crud_tests/write/updateOne-collation.yml +24 -0
- data/spec/support/crud_tests/write/updateOne.yml +7 -33
- data/spec/support/sdam/rs/new_primary_new_setversion.yml +1 -1
- data/spec/support/sdam/rs/null_election_id.yml +1 -0
- data/spec/support/sdam/rs/primary_disconnect_electionid.yml +2 -3
- data/spec/support/sdam/rs/primary_disconnect_setversion.yml +1 -2
- data/spec/support/sdam/single/direct_connection_rsarbiter.yml +1 -1
- data/spec/support/sdam/single/direct_connection_rsprimary.yml +1 -1
- data/spec/support/sdam/single/direct_connection_rssecondary.yml +1 -1
- metadata +40 -4
- metadata.gz.sig +0 -0
@@ -2,7 +2,6 @@ data:
|
|
2
2
|
- {_id: 1, x: 11}
|
3
3
|
- {_id: 2, x: 22}
|
4
4
|
- {_id: 3, x: 33}
|
5
|
-
- {_id: 4, x: 'ping'}
|
6
5
|
|
7
6
|
tests:
|
8
7
|
-
|
@@ -10,7 +9,7 @@ tests:
|
|
10
9
|
operation:
|
11
10
|
name: findOneAndReplace
|
12
11
|
arguments:
|
13
|
-
filter:
|
12
|
+
filter:
|
14
13
|
_id: {$gt: 1}
|
15
14
|
replacement: {x: 32}
|
16
15
|
projection: {x: 1, _id: 0}
|
@@ -23,13 +22,12 @@ tests:
|
|
23
22
|
- {_id: 1, x: 11}
|
24
23
|
- {_id: 2, x: 32}
|
25
24
|
- {_id: 3, x: 33}
|
26
|
-
- {_id: 4, x: 'ping'}
|
27
25
|
-
|
28
26
|
description: "FindOneAndReplace when many documents match returning the document after modification"
|
29
27
|
operation:
|
30
28
|
name: findOneAndReplace
|
31
29
|
arguments:
|
32
|
-
filter:
|
30
|
+
filter:
|
33
31
|
_id: {$gt: 1}
|
34
32
|
replacement: {x: 32}
|
35
33
|
projection: {x: 1, _id: 0}
|
@@ -43,7 +41,6 @@ tests:
|
|
43
41
|
- {_id: 1, x: 11}
|
44
42
|
- {_id: 2, x: 32}
|
45
43
|
- {_id: 3, x: 33}
|
46
|
-
- {_id: 4, x: 'ping'}
|
47
44
|
-
|
48
45
|
description: "FindOneAndReplace when one document matches returning the document before modification"
|
49
46
|
operation:
|
@@ -61,7 +58,6 @@ tests:
|
|
61
58
|
- {_id: 1, x: 11}
|
62
59
|
- {_id: 2, x: 32}
|
63
60
|
- {_id: 3, x: 33}
|
64
|
-
- {_id: 4, x: 'ping'}
|
65
61
|
-
|
66
62
|
description: "FindOneAndReplace when one document matches returning the document after modification"
|
67
63
|
operation:
|
@@ -80,35 +76,13 @@ tests:
|
|
80
76
|
- {_id: 1, x: 11}
|
81
77
|
- {_id: 2, x: 32}
|
82
78
|
- {_id: 3, x: 33}
|
83
|
-
- {_id: 4, x: 'ping'}
|
84
|
-
|
85
|
-
-
|
86
|
-
description: "FindOneAndReplace when one document matches with collation returning the document after modification"
|
87
|
-
operation:
|
88
|
-
name: findOneAndReplace
|
89
|
-
arguments:
|
90
|
-
filter: {x: 'PING'}
|
91
|
-
replacement: {x: 32}
|
92
|
-
projection: {x: 1, _id: 0}
|
93
|
-
returnDocument: After
|
94
|
-
sort: {x: 1}
|
95
|
-
collation: { locale: 'en_US', strength: 2 }
|
96
|
-
|
97
|
-
outcome:
|
98
|
-
result: {x: 32}
|
99
|
-
collection:
|
100
|
-
data:
|
101
|
-
- {_id: 1, x: 11}
|
102
|
-
- {_id: 2, x: 22}
|
103
|
-
- {_id: 3, x: 33}
|
104
|
-
- {_id: 4, x: 32}
|
105
79
|
-
|
106
80
|
description: "FindOneAndReplace when no documents match returning the document before modification"
|
107
81
|
operation:
|
108
82
|
name: findOneAndReplace
|
109
83
|
arguments:
|
110
|
-
filter: {_id:
|
111
|
-
replacement: {x:
|
84
|
+
filter: {_id: 4}
|
85
|
+
replacement: {x: 44}
|
112
86
|
projection: {x: 1, _id: 0}
|
113
87
|
sort: {x: 1}
|
114
88
|
|
@@ -119,34 +93,27 @@ tests:
|
|
119
93
|
- {_id: 1, x: 11}
|
120
94
|
- {_id: 2, x: 22}
|
121
95
|
- {_id: 3, x: 33}
|
122
|
-
- {_id: 4, x: 'ping'}
|
123
96
|
-
|
124
97
|
description: "FindOneAndReplace when no documents match with upsert returning the document before modification"
|
125
98
|
operation:
|
126
99
|
name: findOneAndReplace
|
127
100
|
arguments:
|
128
|
-
filter: {_id:
|
129
|
-
replacement: {x:
|
101
|
+
filter: {_id: 4}
|
102
|
+
replacement: {x: 44}
|
130
103
|
projection: {x: 1, _id: 0}
|
131
104
|
sort: {x: 1}
|
132
105
|
upsert: true
|
133
106
|
|
134
107
|
outcome:
|
135
108
|
result: null
|
136
|
-
collection
|
137
|
-
data:
|
138
|
-
- {_id: 1, x: 11}
|
139
|
-
- {_id: 2, x: 22}
|
140
|
-
- {_id: 3, x: 33}
|
141
|
-
- {_id: 4, x: 'ping'}
|
142
|
-
- {_id: 5, x: 55}
|
109
|
+
# See SERVER-5289 for why the collection data is not checked for server versions < 2.6
|
143
110
|
-
|
144
111
|
description: "FindOneAndReplace when no documents match returning the document after modification"
|
145
112
|
operation:
|
146
113
|
name: findOneAndReplace
|
147
114
|
arguments:
|
148
|
-
filter: {_id:
|
149
|
-
replacement: {x:
|
115
|
+
filter: {_id: 4}
|
116
|
+
replacement: {x: 44}
|
150
117
|
projection: {x: 1, _id: 0}
|
151
118
|
returnDocument: After
|
152
119
|
sort: {x: 1}
|
@@ -158,25 +125,18 @@ tests:
|
|
158
125
|
- {_id: 1, x: 11}
|
159
126
|
- {_id: 2, x: 22}
|
160
127
|
- {_id: 3, x: 33}
|
161
|
-
- {_id: 4, x: 'ping'}
|
162
128
|
-
|
163
129
|
description: "FindOneAndReplace when no documents match with upsert returning the document after modification"
|
164
130
|
operation:
|
165
131
|
name: findOneAndReplace
|
166
132
|
arguments:
|
167
|
-
filter: {_id:
|
168
|
-
replacement: {x:
|
133
|
+
filter: {_id: 4}
|
134
|
+
replacement: {x: 44}
|
169
135
|
projection: {x: 1, _id: 0}
|
170
136
|
returnDocument: After
|
171
137
|
sort: {x: 1}
|
172
138
|
upsert: true
|
173
139
|
|
174
140
|
outcome:
|
175
|
-
result: {x:
|
176
|
-
collection
|
177
|
-
data:
|
178
|
-
- {_id: 1, x: 11}
|
179
|
-
- {_id: 2, x: 22}
|
180
|
-
- {_id: 3, x: 33}
|
181
|
-
- {_id: 4, x: 'ping'}
|
182
|
-
- {_id: 5, x: 55}
|
141
|
+
result: {x: 44}
|
142
|
+
# See SERVER-5289 for why the collection data is not checked for server versions < 2.6
|
@@ -0,0 +1,27 @@
|
|
1
|
+
data:
|
2
|
+
- {_id: 1, x: 11}
|
3
|
+
- {_id: 2, x: 'ping'}
|
4
|
+
- {_id: 3, x: 'pINg'}
|
5
|
+
minServerVersion: '3.4'
|
6
|
+
|
7
|
+
tests:
|
8
|
+
-
|
9
|
+
description: "FindOneAndUpdate when many documents match with collation returning the document before modification"
|
10
|
+
operation:
|
11
|
+
name: findOneAndUpdate
|
12
|
+
arguments:
|
13
|
+
filter:
|
14
|
+
x: 'PING'
|
15
|
+
update:
|
16
|
+
$set: {x: 'pong'}
|
17
|
+
projection: {x: 1, _id: 0}
|
18
|
+
sort: {_id: 1}
|
19
|
+
collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document
|
20
|
+
|
21
|
+
outcome:
|
22
|
+
result: {x: 'ping'}
|
23
|
+
collection:
|
24
|
+
data:
|
25
|
+
- {_id: 1, x: 11}
|
26
|
+
- {_id: 2, x: 'pong'}
|
27
|
+
- {_id: 3, x: 'pINg'}
|
@@ -2,8 +2,6 @@ data:
|
|
2
2
|
- {_id: 1, x: 11}
|
3
3
|
- {_id: 2, x: 22}
|
4
4
|
- {_id: 3, x: 33}
|
5
|
-
- {_id: 4, x: 'ping'}
|
6
|
-
- {_id: 5, x: 'pINg'}
|
7
5
|
|
8
6
|
tests:
|
9
7
|
-
|
@@ -11,9 +9,9 @@ tests:
|
|
11
9
|
operation:
|
12
10
|
name: findOneAndUpdate
|
13
11
|
arguments:
|
14
|
-
filter:
|
12
|
+
filter:
|
15
13
|
_id: {$gt: 1}
|
16
|
-
update:
|
14
|
+
update:
|
17
15
|
$inc: {x: 1}
|
18
16
|
projection: {x: 1, _id: 0}
|
19
17
|
sort: {x: 1}
|
@@ -25,32 +23,6 @@ tests:
|
|
25
23
|
- {_id: 1, x: 11}
|
26
24
|
- {_id: 2, x: 23}
|
27
25
|
- {_id: 3, x: 33}
|
28
|
-
- {_id: 4, x: 'ping'}
|
29
|
-
- {_id: 5, x: 'pINg'}
|
30
|
-
|
31
|
-
-
|
32
|
-
description: "FindOneAndUpdate when many documents match with collation returning the document before modification"
|
33
|
-
operation:
|
34
|
-
name: findOneAndUpdate
|
35
|
-
arguments:
|
36
|
-
filter:
|
37
|
-
x: 'PING'
|
38
|
-
update:
|
39
|
-
$set: {x: 'pong'}
|
40
|
-
projection: {x: 1, _id: 0}
|
41
|
-
sort: {_id: 1}
|
42
|
-
collation: { locale: 'en_US', strength: 2 }
|
43
|
-
|
44
|
-
outcome:
|
45
|
-
result: {x: 'ping'}
|
46
|
-
collection:
|
47
|
-
data:
|
48
|
-
- {_id: 1, x: 11}
|
49
|
-
- {_id: 2, x: 22}
|
50
|
-
- {_id: 3, x: 33}
|
51
|
-
- {_id: 4, x: 'pong'}
|
52
|
-
- {_id: 5, x: 'pINg'}
|
53
|
-
|
54
26
|
-
|
55
27
|
description: "FindOneAndUpdate when many documents match returning the document after modification"
|
56
28
|
operation:
|
@@ -71,8 +43,6 @@ tests:
|
|
71
43
|
- {_id: 1, x: 11}
|
72
44
|
- {_id: 2, x: 23}
|
73
45
|
- {_id: 3, x: 33}
|
74
|
-
- {_id: 4, x: 'ping'}
|
75
|
-
- {_id: 5, x: 'pINg'}
|
76
46
|
-
|
77
47
|
description: "FindOneAndUpdate when one document matches returning the document before modification"
|
78
48
|
operation:
|
@@ -91,8 +61,6 @@ tests:
|
|
91
61
|
- {_id: 1, x: 11}
|
92
62
|
- {_id: 2, x: 23}
|
93
63
|
- {_id: 3, x: 33}
|
94
|
-
- {_id: 4, x: 'ping'}
|
95
|
-
- {_id: 5, x: 'pINg'}
|
96
64
|
-
|
97
65
|
description: "FindOneAndUpdate when one document matches returning the document after modification"
|
98
66
|
operation:
|
@@ -112,14 +80,12 @@ tests:
|
|
112
80
|
- {_id: 1, x: 11}
|
113
81
|
- {_id: 2, x: 23}
|
114
82
|
- {_id: 3, x: 33}
|
115
|
-
- {_id: 4, x: 'ping'}
|
116
|
-
- {_id: 5, x: 'pINg'}
|
117
83
|
-
|
118
84
|
description: "FindOneAndUpdate when no documents match returning the document before modification"
|
119
85
|
operation:
|
120
86
|
name: findOneAndUpdate
|
121
87
|
arguments:
|
122
|
-
filter: {_id:
|
88
|
+
filter: {_id: 4}
|
123
89
|
update:
|
124
90
|
$inc: {x: 1}
|
125
91
|
projection: {x: 1, _id: 0}
|
@@ -132,14 +98,12 @@ tests:
|
|
132
98
|
- {_id: 1, x: 11}
|
133
99
|
- {_id: 2, x: 22}
|
134
100
|
- {_id: 3, x: 33}
|
135
|
-
- {_id: 4, x: 'ping'}
|
136
|
-
- {_id: 5, x: 'pINg'}
|
137
101
|
-
|
138
102
|
description: "FindOneAndUpdate when no documents match with upsert returning the document before modification"
|
139
103
|
operation:
|
140
104
|
name: findOneAndUpdate
|
141
105
|
arguments:
|
142
|
-
filter: {_id:
|
106
|
+
filter: {_id: 4}
|
143
107
|
update:
|
144
108
|
$inc: {x: 1}
|
145
109
|
projection: {x: 1, _id: 0}
|
@@ -153,15 +117,13 @@ tests:
|
|
153
117
|
- {_id: 1, x: 11}
|
154
118
|
- {_id: 2, x: 22}
|
155
119
|
- {_id: 3, x: 33}
|
156
|
-
- {_id: 4, x:
|
157
|
-
- {_id: 5, x: 'pINg'}
|
158
|
-
- {_id: 6, x: 1}
|
120
|
+
- {_id: 4, x: 1}
|
159
121
|
-
|
160
122
|
description: "FindOneAndUpdate when no documents match returning the document after modification"
|
161
123
|
operation:
|
162
124
|
name: findOneAndUpdate
|
163
125
|
arguments:
|
164
|
-
filter: {_id:
|
126
|
+
filter: {_id: 4}
|
165
127
|
update:
|
166
128
|
$inc: {x: 1}
|
167
129
|
projection: {x: 1, _id: 0}
|
@@ -175,14 +137,12 @@ tests:
|
|
175
137
|
- {_id: 1, x: 11}
|
176
138
|
- {_id: 2, x: 22}
|
177
139
|
- {_id: 3, x: 33}
|
178
|
-
- {_id: 4, x: 'ping'}
|
179
|
-
- {_id: 5, x: 'pINg'}
|
180
140
|
-
|
181
141
|
description: "FindOneAndUpdate when no documents match with upsert returning the document after modification"
|
182
142
|
operation:
|
183
143
|
name: findOneAndUpdate
|
184
144
|
arguments:
|
185
|
-
filter: {_id:
|
145
|
+
filter: {_id: 4}
|
186
146
|
update:
|
187
147
|
$inc: {x: 1}
|
188
148
|
projection: {x: 1, _id: 0}
|
@@ -197,7 +157,4 @@ tests:
|
|
197
157
|
- {_id: 1, x: 11}
|
198
158
|
- {_id: 2, x: 22}
|
199
159
|
- {_id: 3, x: 33}
|
200
|
-
- {_id: 4, x:
|
201
|
-
- {_id: 5, x: 'pINg'}
|
202
|
-
- {_id: 6, x: 1}
|
203
|
-
|
160
|
+
- {_id: 4, x: 1}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
data:
|
2
|
+
- {_id: 1, x: 11}
|
3
|
+
- {_id: 2, x: 'ping'}
|
4
|
+
minServerVersion: '3.4'
|
5
|
+
|
6
|
+
tests:
|
7
|
+
-
|
8
|
+
description: "ReplaceOne when one document matches with collation"
|
9
|
+
operation:
|
10
|
+
name: "replaceOne"
|
11
|
+
arguments:
|
12
|
+
filter: {x: 'PING'}
|
13
|
+
replacement: {_id: 2, x: 'pong'}
|
14
|
+
collation: {locale: 'en_US', strength: 2} # https://docs.mongodb.com/master/reference/collation/#collation-document
|
15
|
+
|
16
|
+
outcome:
|
17
|
+
result:
|
18
|
+
matchedCount: 1
|
19
|
+
modifiedCount: 1
|
20
|
+
collection:
|
21
|
+
data:
|
22
|
+
- {_id: 1, x: 11}
|
23
|
+
- {_id: 2, x: 'pong'}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
data:
|
2
|
+
- {_id: 1, x: 11}
|
3
|
+
- {_id: 2, x: 22}
|
4
|
+
- {_id: 3, x: 33}
|
5
|
+
minServerVersion: '2.6'
|
6
|
+
# See SERVER-5289 for why the collection data is only checked for server versions >= 2.6
|
7
|
+
|
8
|
+
tests:
|
9
|
+
-
|
10
|
+
description: "ReplaceOne with upsert when no documents match without an id specified"
|
11
|
+
operation:
|
12
|
+
name: "replaceOne"
|
13
|
+
arguments:
|
14
|
+
filter: {_id: 4}
|
15
|
+
replacement: {x: 1}
|
16
|
+
upsert: true
|
17
|
+
|
18
|
+
outcome:
|
19
|
+
result:
|
20
|
+
matchedCount: 0
|
21
|
+
modifiedCount: 0
|
22
|
+
upsertedId: 4
|
23
|
+
collection:
|
24
|
+
data:
|
25
|
+
- {_id: 1, x: 11}
|
26
|
+
- {_id: 2, x: 22}
|
27
|
+
- {_id: 3, x: 33}
|
28
|
+
- {_id: 4, x: 1}
|
29
|
+
-
|
30
|
+
description: "ReplaceOne with upsert when no documents match with an id specified"
|
31
|
+
operation:
|
32
|
+
name: "replaceOne"
|
33
|
+
arguments:
|
34
|
+
filter: {_id: 4}
|
35
|
+
replacement: {_id: 4, x: 1}
|
36
|
+
upsert: true
|
37
|
+
|
38
|
+
outcome:
|
39
|
+
result:
|
40
|
+
matchedCount: 0
|
41
|
+
modifiedCount: 0
|
42
|
+
upsertedId: 4
|
43
|
+
collection:
|
44
|
+
data:
|
45
|
+
- {_id: 1, x: 11}
|
46
|
+
- {_id: 2, x: 22}
|
47
|
+
- {_id: 3, x: 33}
|
48
|
+
- {_id: 4, x: 1}
|
@@ -2,7 +2,6 @@ data:
|
|
2
2
|
- {_id: 1, x: 11}
|
3
3
|
- {_id: 2, x: 22}
|
4
4
|
- {_id: 3, x: 33}
|
5
|
-
- {_id: 4, x: 'ping'}
|
6
5
|
|
7
6
|
tests:
|
8
7
|
-
|
@@ -10,7 +9,7 @@ tests:
|
|
10
9
|
operation:
|
11
10
|
name: "replaceOne"
|
12
11
|
arguments:
|
13
|
-
filter:
|
12
|
+
filter:
|
14
13
|
_id: {$gt: 1}
|
15
14
|
replacement: {x: 111}
|
16
15
|
|
@@ -37,33 +36,13 @@ tests:
|
|
37
36
|
- {_id: 1, x: 111}
|
38
37
|
- {_id: 2, x: 22}
|
39
38
|
- {_id: 3, x: 33}
|
40
|
-
- {_id: 4, x: 'ping'}
|
41
|
-
-
|
42
|
-
description: "ReplaceOne when one document matches with collation"
|
43
|
-
operation:
|
44
|
-
name: "replaceOne"
|
45
|
-
arguments:
|
46
|
-
filter: {x: 'PING'}
|
47
|
-
replacement: {_id: 4, x: 'pong'}
|
48
|
-
collation: {locale: 'en_US', strength: 2}
|
49
|
-
|
50
|
-
outcome:
|
51
|
-
result:
|
52
|
-
matchedCount: 1
|
53
|
-
modifiedCount: 1
|
54
|
-
collection:
|
55
|
-
data:
|
56
|
-
- {_id: 1, x: 11}
|
57
|
-
- {_id: 2, x: 22}
|
58
|
-
- {_id: 3, x: 33}
|
59
|
-
- {_id: 4, x: 'pong'}
|
60
39
|
-
|
61
40
|
description: "ReplaceOne when no documents match"
|
62
41
|
operation:
|
63
42
|
name: "replaceOne"
|
64
43
|
arguments:
|
65
|
-
filter: {_id:
|
66
|
-
replacement: {_id:
|
44
|
+
filter: {_id: 4}
|
45
|
+
replacement: {_id: 4, x: 1}
|
67
46
|
|
68
47
|
outcome:
|
69
48
|
result:
|
@@ -74,13 +53,12 @@ tests:
|
|
74
53
|
- {_id: 1, x: 11}
|
75
54
|
- {_id: 2, x: 22}
|
76
55
|
- {_id: 3, x: 33}
|
77
|
-
- {_id: 4, x: 'ping'}
|
78
56
|
-
|
79
57
|
description: "ReplaceOne with upsert when no documents match without an id specified"
|
80
58
|
operation:
|
81
59
|
name: "replaceOne"
|
82
60
|
arguments:
|
83
|
-
filter: {_id:
|
61
|
+
filter: {_id: 4}
|
84
62
|
replacement: {x: 1}
|
85
63
|
upsert: true
|
86
64
|
|
@@ -88,33 +66,21 @@ tests:
|
|
88
66
|
result:
|
89
67
|
matchedCount: 0
|
90
68
|
modifiedCount: 0
|
91
|
-
upsertedId:
|
92
|
-
collection
|
93
|
-
|
94
|
-
- {_id: 1, x: 11}
|
95
|
-
- {_id: 2, x: 22}
|
96
|
-
- {_id: 3, x: 33}
|
97
|
-
- {_id: 4, x: 'ping'}
|
98
|
-
- {_id: 5, x: 1}
|
69
|
+
upsertedId: 4
|
70
|
+
# See SERVER-5289 for why the collection data is not checked for server versions < 2.6
|
71
|
+
|
99
72
|
-
|
100
73
|
description: "ReplaceOne with upsert when no documents match with an id specified"
|
101
74
|
operation:
|
102
75
|
name: "replaceOne"
|
103
76
|
arguments:
|
104
|
-
filter: {_id:
|
105
|
-
replacement: {_id:
|
77
|
+
filter: {_id: 4}
|
78
|
+
replacement: {_id: 4, x: 1}
|
106
79
|
upsert: true
|
107
80
|
|
108
81
|
outcome:
|
109
82
|
result:
|
110
83
|
matchedCount: 0
|
111
84
|
modifiedCount: 0
|
112
|
-
upsertedId:
|
113
|
-
collection
|
114
|
-
data:
|
115
|
-
- {_id: 1, x: 11}
|
116
|
-
- {_id: 2, x: 22}
|
117
|
-
- {_id: 3, x: 33}
|
118
|
-
- {_id: 4, x: 'ping'}
|
119
|
-
- {_id: 5, x: 1}
|
120
|
-
|
85
|
+
upsertedId: 4
|
86
|
+
# See SERVER-5289 for why the collection data is not checked for server versions < 2.6
|