[JAVA-2718] InsertMany with InsertOptions should allow for unordered data structure Created: 27/Dec/17  Updated: 08/Jan/18  Resolved: 08/Jan/18

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 3.6.1
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Ricardo Espirito Santo Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change

 Description   

Since methods like insertMany accept both a List of elements and an InsertManyOptions which may allow for unordered insertion the API should allow for unordered collections to be passed in instead of the Always ordered java.util.List.

I'm attaching a PR where I propose for the methods that accept Lists of elements and InsertManyOptions to be changed from:

void insertMany(List<? extends TDocument> documents, InsertManyOptions options);

to:

void insertMany(Collection<? extends TDocument> documents, InsertManyOptions options);



 Comments   
Comment by Jeffrey Yemin [ 27/Dec/17 ]

Unfortunately this change would break binary compatibility with previous versions of the library . See 13.4.12 and 13.4.14 of the JLS.

While overloads could be added, I don't want to pollute the API with eight new overloads (four insertMany methods and four bulkWrite methods).

Comment by Ricardo Espirito Santo [ 27/Dec/17 ]

PR: https://github.com/mongodb/mongo-java-driver/pull/437

Generated at Thu Feb 08 08:57:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.