[CDRIVER-1573] Replace bulk_operation_update_with_opts()/bulk_operation_remove_with_opts() with bulk_operation_update_many_with_opts()/bulk_operation_remove_many_with_opts() Created: 30/Sep/16 Updated: 19/Oct/16 Resolved: 12/Oct/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | None |
| Fix Version/s: | 1.5.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | J Rassi | Assignee: | Hannes Magnusson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Description |
|
bulk_operation_remove_with_opts() has the awkward behavior that it will send an invalid operation to the server if the "limit" option is not specified. Similarly, bulk_operation_update_with_opts() has the unintuitive behavior that it will perform a single-update unless the "multi" option is specified as true. These API functions should be removed and replaced with new API functions bulk_operation_remove_many_with_opts() and bulk_operation_update_many_with_opts(). Like their bulk_operation_*_one_with_opts() counterparts, these API functions should set the "multi" and "limit" options appropriately on the generated requests. |
| Comments |
| Comment by Githook User [ 12/Oct/16 ] |
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: |
| Comment by Githook User [ 12/Oct/16 ] |
|
Author: {u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}Message: |
| Comment by A. Jesse Jiryu Davis [ 30/Sep/16 ] |
|
I think it's helpful for future users of the C Driver to have:
My justification here is very similar to my justification in the original ticket: let's be more like the standard drivers. Being closer to the specs is better than being farther from the specs. Also, if this confused Rassi, imagine how easily we'll confuse users who aren't experts? It's not too late to change this at all! But it will be too late if we don't do it before we release 1.5.0. In C Driver 2.0 these will be the only bulk operation functions, so let's make them perfect now, and then we won't have to change them again later. More changes:
|
| Comment by Hannes Magnusson [ 30/Sep/16 ] |
|
You are right that mongoc_bulk_operation_remove_with_opts should set limit=0 if none was provided and mongoc_bulk_update_with_opts should set multi=true if none provided. That makes sense and consistent with the existing functions. I don't agree with the renaming though. The _with_opts functions are modelled after the current functions where by they do "multi" by default, and then there is a _one variant of that function. |