[JAVA-4281] Unable to specify an index hint using a String in legacy driver 4.3 Created: 23/Aug/21 Updated: 28/Oct/23 Resolved: 15/Oct/21 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Legacy API |
| Affects Version/s: | None |
| Fix Version/s: | 4.4.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Marc O'Morain | Assignee: | Jeffrey Yemin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | external-user | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Hi there, We are currently attempting to upgrade a the Clojure MongoDB driver from Java driver 3.12 to 4.3. We have hit a problem trying to specify the index to use by name when issuing a find command. We are being very careful and trying to ensure that we do not break the API. We have a com.mongodb.DBCollection object, and we are attempting to call .find, in such a way that we can also specify an index hint using the String name of the index. The previous code called the .hint function that takes a String argument, the name of the index. I can't find a way to achieve the same result in the 4.3 legacy driver. The .find function on DBCollection doesn't accept a hint. It returns a DBCursor though. I can set a hint on the DBCursor, but this artity only accepts a sequence of DB keys as the hint, not the string name of the index.
|
| Comments |
| Comment by Marc O'Morain [ 30/Aug/21 ] |
|
That would be great, thanks Jeffrey. |
| Comment by Jeffrey Yemin [ 30/Aug/21 ] |
|
Thanks for bringing this to our attention. It does indeed look like a mistake that this method was deprecated. Unfortunately, I don't see a good workaround using the 4.3 driver. The best I can offer is that we add the method back in the next minor release (4.4.0), which will be cut in about six weeks. Will that work for you? |