[JAVA-4416] Undocumented behavior change for createIndex from 'DB' api to 'Document' API? Created: 25/Nov/21 Updated: 25/Aug/23 Resolved: 30/Nov/21 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | 3.8.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Gavin Price | Assignee: | Valentin Kavalenka |
| Resolution: | Declined | Votes: | 0 |
| Labels: | external-user | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
We have an application that started on Mongo 2.4, when if a document had an indexed field with size > 1024B, Mongo would insert the document but not include it in the index. When we upgraded to 2.6, which fails when trying to index large fields, we discovered this error the hard way and fixed it in our application. However, the old unindexed documents remained in the collection, and didn't seem to cause any problems. We've since upgraded to Mongo 3.6 (but not yet WiredTiger), and up until recently were using the legacy DB API in the Java client version 3.8.2, using createIndex to ensure/create indexes on application startup. We finally switched over to the new Document based API without updating the client version and now the app will not start due to com.mongodb.MongoWriteException: Btree::insert: key too large to index errors. My assumption here is that the old API would still ignore existing documents with large index values when creating (well, ensuring really, since the indexes have existed for years) indexes, but the new API fails. Is it possible to confirm this? So far I've been unable to do so and I'm worried I'm barking up the wrong tree. |
| Comments |
| Comment by Valentin Kavalenka [ 30/Nov/21 ] |
|
Closed as "Declined" with accordance to the latest reporter's comment. |
| Comment by Gavin Price [ 30/Nov/21 ] |
|
Update: I'm an idiot and didn't read the stack trace carefully enough - as soon as I saw the `key too large to index` error I assumed it was happening on the `createIndex` call. It's actually happening on an `updateMany` call since the new version of the app is performing an update of all the documents in one of the collections. So the old document that couldn't be indexed in 2.4 is updated and 3.6 tries to index it and complains. Sorry for the noise. |