Commit 2b4499a
Feature: Client Bulk Write (#1818)
* PHPC-2478: Implement API for bulkWrite command (#1790)
* PHPC-2495, PHPC-2490, PHPC-2491, PHPC-2492: BulkWriteCommand ctor and ops
* PHPC-2494: BulkWriteCommandResult and BulkWriteCommandException
It was possible to reuse WriteConcernError and WriteError with slight changes to their init functions.
* Include missing header in WriteResult.h
This was not necessary for compilation, but it makes the header internally consistent.
* PHPC-2493: Manager and Server::executeBulkWriteCommand()
* PHPC-2494: Handle null error fields in BulkWriteCommandResult
Always return arrays for writeErrors and writeConcernErrors
* PHPC-2494: Return writeErrors as an associative array
* PHPC-2493: Revise error handling for mongoc_bulkwrite_execute
* Consistent WriteError and WriteConcernError parsing for bulk write results
* BulkWriteCommand tests
* clang-format
* Remove BulkWriteCommandResult::getServer()
Per CDRIVER-5843, libmongoc does not consistently populate this field. It also isn't required by the spec, so omit it for now.
* Check for _id extraction before appending insert
* Regenerate BulkWriteCommandException arginfo
* PHPC-2493: Relocate writeConcern option to executeBulkWriteCommand()
* Parse sort option for replaceOne and updateOne
* BulkWriteCommand::replaceOne() need not accept root-level arrays
* Preserve empty documents for verbose results and error reply
Result maps should only be null if verboseResults=false. Additionally, the error reply document can default to an empty document on error (as it is in libmongoc).
* PHPC-2494: Relocate error fields to BulkWriteCommandException
Revise the stubs to reflect that executeBulkWriteCommand() always returns a BulkWriteCommandResult. If the result is unacknowledged, that is reported via isAcknowledged() and other methods can throw, which is consistent with WriteResult for the legacy bulk write API.
If the result is empty on error (i.e. no writes were successful), BulkWriteCommandException::$partialResult is left unset.
* Throw BulkWriteCommandException directly for server errors
This also ensures that BulkWriteCommandException uses the original server-side error code and message (if available) for top-level errors.
* Check for empty error_reply instead of NULL
mongoc_bulkwriteexception_errorreply() always returns an initialized document, but it may be empty. This ensures that an InvalidArgumentException is not unnecessarily proxied behind a BulkWriteCommandException.
* PHPC-2571 Import BulkWrite tests for Client BulkWriteCommand (#1819)
* Add tests on client bulk write replaceOne, updateMany and deleteMany (#1820)
---------
Co-authored-by: Jeremy Mikola <jmikola@gmail.com>1 parent d3a079f commit 2b4499a
File tree
93 files changed
+5619
-25
lines changed- src
- MongoDB
- Exception
- tests/bulkwritecommand
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
93 files changed
+5619
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
| |||
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| 191 | + | |
189 | 192 | | |
190 | 193 | | |
191 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
255 | 257 | | |
256 | 258 | | |
257 | 259 | | |
| |||
277 | 279 | | |
278 | 280 | | |
279 | 281 | | |
| 282 | + | |
280 | 283 | | |
281 | 284 | | |
282 | 285 | | |
| |||
0 commit comments