Repository navigation
Commit aa06ea7
Reject invalid legacy queries; pass count options through; reject multi replace
_perfect_split_legacy_query treated a $query that isn't a document as an
empty filter, so find() and count() matched every document. It also
merged non-$ fields next to $query into the filter. libmongoc 1.x's
legacy find rejected both ("Cannot mix $query with non-dollar field",
"Invalid BSON in $query subdocument"), and now the shim does too:
count() returns the error, find() returns nil (libmongoc 2 can't hand
back a cursor carrying the error, and MongoCursor exposes no error), and
GridFS list(filter:) throws. A duplicate $query now means the last one
wins, as in 1.x; before, the two were merged. (1.x's legacy count never
unwrapped $query at all; current servers reject a raw $query in count.)
_perfect_collection_count built the legacy find options and threw them
away. hint, maxTimeMS, comment and collation now reach count_documents.
$orderby, $max, $min and the other find-only modifiers are still ignored,
and the doc comment says so. A negative legacy limit is passed as its
absolute value, as the old count command treated it; before, the $limit
stage rejected it. INT64_MIN, which has no absolute value, is an error.
The doc comment also notes that count() can't use $where, $near or
$nearSphere, since count_documents runs the query as a $match.
update() with .multiUpdate and a replacement document replaced one
document and reported success. It now returns an error without writing,
with the server's own message for this case ("multi update is not
supported for replacement-style update"; the server's code is 9, this
is a client-side MONGOC_ERROR_COMMAND_INVALID_ARG).
Tests: 4 new tests. 14 of their checks fail on main (the rest are
baseline checks that pass either way). The comment check uses the
profiler in a database of its own, which it drops, and skips when the
server refuses profiling. All 40 tests pass against mongod 8.3.11 on
macOS (debug and release) and on Linux (Scripts/test-linux.sh).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent cf6120f commit aa06ea7
3 files changed
Lines changed: 181 additions & 23 deletions
File tree
- Sources
- PerfectCMongo
- PerfectMongoDB
- Tests/PerfectMongoDBTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | | - | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
41 | 54 | | |
42 | 55 | | |
43 | 56 | | |
44 | 57 | | |
45 | 58 | | |
46 | 59 | | |
47 | | - | |
48 | | - | |
49 | 60 | | |
50 | | - | |
| 61 | + | |
51 | 62 | | |
52 | 63 | | |
| 64 | + | |
53 | 65 | | |
54 | 66 | | |
55 | 67 | | |
| |||
88 | 100 | | |
89 | 101 | | |
90 | 102 | | |
| 103 | + | |
91 | 104 | | |
92 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
93 | 112 | | |
94 | 113 | | |
95 | 114 | | |
| |||
114 | 133 | | |
115 | 134 | | |
116 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
117 | 141 | | |
118 | 142 | | |
119 | 143 | | |
120 | 144 | | |
121 | 145 | | |
122 | 146 | | |
123 | 147 | | |
| 148 | + | |
124 | 149 | | |
125 | 150 | | |
126 | 151 | | |
127 | 152 | | |
128 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
129 | 156 | | |
130 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
131 | 160 | | |
132 | 161 | | |
133 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
134 | 168 | | |
135 | 169 | | |
136 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
137 | 176 | | |
138 | | - | |
| 177 | + | |
139 | 178 | | |
140 | 179 | | |
| 180 | + | |
141 | 181 | | |
142 | 182 | | |
143 | 183 | | |
| |||
151 | 191 | | |
152 | 192 | | |
153 | 193 | | |
154 | | - | |
| 194 | + | |
| 195 | + | |
155 | 196 | | |
156 | | - | |
157 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
158 | 200 | | |
159 | 201 | | |
160 | 202 | | |
| |||
185 | 227 | | |
186 | 228 | | |
187 | 229 | | |
| 230 | + | |
| 231 | + | |
188 | 232 | | |
189 | 233 | | |
190 | 234 | | |
191 | 235 | | |
192 | 236 | | |
193 | 237 | | |
194 | 238 | | |
| 239 | + | |
195 | 240 | | |
196 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
197 | 247 | | |
198 | 248 | | |
199 | 249 | | |
200 | 250 | | |
201 | 251 | | |
202 | 252 | | |
203 | | - | |
| 253 | + | |
204 | 254 | | |
205 | 255 | | |
206 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
| 558 | + | |
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
| 675 | + | |
| 676 | + | |
675 | 677 | | |
676 | 678 | | |
677 | 679 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
988 | 988 | | |
989 | 989 | | |
990 | 990 | | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
991 | 1097 | | |
992 | 1098 | | |
993 | 1099 | | |
| |||
0 commit comments