[JAVA-2401] Create an API for creating IndexOptions from Bson objects Created: 07/Dec/16 Updated: 28/Mar/17 Resolved: 28/Mar/17 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Tomasz Piskorski [X] | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
As a user I want to have an API for easy creating IndexOptions from Bson objects. Given Bson object containing all the options I need - I have to individually map them into IndexOptions. |
| Comments |
| Comment by Jeffrey Yemin [ 26/Jan/17 ] |
|
I'm inclined to close as Won't Fix, given that:
Fundamentally, we don't expect a significant proportion of our users will have the requirement to configure options classes via BSON/JSON, and those that do can straightforwardly write their own code to map between the two. |
| Comment by Jeffrey Yemin [ 28/Dec/16 ] |
|
There is a org.bson.BsonArray#parse method, but that's not going to help you transform each BsonDocument in the BsonArray into an instance of IndexOptions. You'd still have to write that code manually. Another options is to use MongoDatabase.command() and construct the createIndexes command in your application. |
| Comment by Tomasz Piskorski [X] [ 22/Dec/16 ] |
|
We store all indexes per collection in a single json file. So itrs an array of objects. [ , We wanted to move from mongo 2 to mongo 3 API. Document.parse parses only single JSON object, lacking the functionality of parsing the array of objects. We used third party library on top of that. |
| Comment by Jeffrey Yemin [ 22/Dec/16 ] |
|
Where is your application getting the Bson object that contains all the options you need? If the driver provided this, it would have to do it for all the options classes in com.mongodb.client.model, so we'd really like to understand the use case for this request. |