[JAVA-1747] It it safe to clone() a BulkWriteOperation? Created: 07/Apr/15 Updated: 11/Sep/19 Resolved: 23/Jun/15 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | John Page | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
I'm using buk write operations and trying to make them work correctly in the event of a Primary failure. When my primary fails the returned BulkWriteResult is null - I'd like to run execute() again on the BulkWriteOperation but I can't because it's 'already executed' Whats the correct pattern here? only create bulkWriters at the last moment and stage all the insets/updates in another collection? use clone() to create a copy to use before the execute() How do I use this safely? |
| Comments |
| Comment by Jeffrey Yemin [ 07/Apr/15 ] |
|
Are you able to use the 3.0 driver? I think we've addressed this problem in the new MongoCollection API. See http://mongodb.github.io/mongo-java-driver/3.0/driver/getting-started/quick-tour/#bulk-operations for an example. |