[CDRIVER-947] Allow setting of ordered option on bulk writes Created: 20/Oct/15 Updated: 23/Oct/15 Resolved: 20/Oct/15 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.3.0-beta0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Matt Cotter | Assignee: | Matt Cotter |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
The new CRUD API requires the ability to set the ordered option on bulk operations. The C driver should have a helper for this because the underlying flags struct is not exposed. |
| Comments |
| Comment by Hannes Magnusson [ 20/Oct/15 ] | ||||||||||||||||||||
|
I think originally originally then the driver branched on `ordered` while adding stuff to the bulk, hence requiring the need of specifying `ordered` upfront. Today, there is no need (that I can think of) to initialize it upfront - but on the other hand, I also don't see the need to set it explicitly after instantiating a bulk_operation. If you want a concrete case, then please do re-open the ticket - for now, I'm marking it as works-as-designed | ||||||||||||||||||||
| Comment by Matt Cotter [ 20/Oct/15 ] | ||||||||||||||||||||
|
Ah, the PyMongo example clarified my confusion! In my interpretation of the spec (and PyMongo) the logic goes like:
But in the C (and current C++11 driver), the logic is:
Hopefully that illustrates the source of my confusion. It seems now that this ticket is inapplicable, and likely that the C++11 driver will have to stay as is. What do you two think? (edit: formatting) | ||||||||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 20/Oct/15 ] | ||||||||||||||||||||
|
You sure the spec requires setting the option after creation? PyMongo, at least, doesn't: And I don't see anything in the spec that requires you to let the user change her mind. | ||||||||||||||||||||
| Comment by Matt Cotter [ 20/Oct/15 ] | ||||||||||||||||||||
|
When does it need to be set? For the CRUD API, the C++ driver needs to implement the bulk write options:
Edit: As it stands, the C++ driver only supports setting the order upon creation. | ||||||||||||||||||||
| Comment by Hannes Magnusson [ 20/Oct/15 ] | ||||||||||||||||||||
Is it not enough to initialize the batch as ordered/unordered? |