[CDRIVER-1525] Flexible opts for bulk operations Created: 07/Sep/16 Updated: 11/Dec/16 Resolved: 12/Sep/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | Bulk API, libmongoc |
| Affects Version/s: | None |
| Fix Version/s: | 1.5.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | A. Jesse Jiryu Davis | Assignee: | Hannes Magnusson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Epic Link: | Flexible opts | ||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Description |
|
Implement these new functions:
"opts" can be NULL. I think each function appends "opts" to the operation without any validation. Example for write commands:
This produces:
Another example:
Produces:
Once this is complete, re-enable the bulk upsert and bulk collation examples by reverting this commit: https://github.com/mongodb/mongo-c-driver/commit/a497587867fe28dac954d0244ca6fb4bfc5e4a38 (Yes, revert the revert.) |
| Comments |
| Comment by Githook User [ 11/Dec/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: |
| Comment by Githook User [ 12/Sep/16 ] |
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: |
| Comment by Githook User [ 12/Sep/16 ] |
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: |
| Comment by A. Jesse Jiryu Davis [ 09/Sep/16 ] |
|
If users include "multi" in "opts", let's make that an error. You shouldn't be able to call update_one with "multi" true. |
| Comment by A. Jesse Jiryu Davis [ 09/Sep/16 ] |
|
I'd really like us to add mongoc_bulk_operation_remove_one_with_opts and mongoc_bulk_operation_update_one_with_opts. The server's "multi" option is a bad API. The main problem is that "update" and "remove" have different defaults ("false" and "true", respectively), and the defaults are bad, and users can't remember the defaults. Therefore, all our driver API specs have fixed the problems with "multi" by distinguishing between "one" and "many" explicitly. For example, the Bulk API has "updateOne" and ""update". That's what we followed in the C Driver. The CRUD Spec is even more explicit, with "updateOne" and "updateMany". There is no bare "update" method in the CRUD Spec. The mongo shell and all the other drivers have now implemented the CRUD API. I fear we'll confused our users badly by making them learn how "multi" works with bulk operations. Let's stick to the existing bulk API but add "opts". |
| Comment by Hannes Magnusson [ 08/Sep/16 ] |
|
I don't think its a good idea to have the _one_with_opts variations. |