[JAVA-3453] MongoCollection.listIndexes() fails when there is an index with partialFilterExpression that contains DBRef Created: 07/Oct/19 Updated: 27/Oct/23 Resolved: 08/Oct/19 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Codecs |
| Affects Version/s: | 3.11.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Miika Vesti | Assignee: | Jeffrey Yemin |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
How to re-produce: First, create an index that has partialFilterExpression which contains DBRef, such as:
Then try to list and print those indexes:
This results in exception:
|
| Comments |
| Comment by Jeffrey Yemin [ 08/Oct/19 ] | ||||
|
Thanks cstrobl | ||||
| Comment by Miika Vesti [ 08/Oct/19 ] | ||||
|
Thanks for the info. This ticket can be closed if this is going to get fixed in Spring Data. | ||||
| Comment by Christoph Strobl [ 08/Oct/19 ] | ||||
|
We're going to ship a fix for Spring Data with the next service release. | ||||
| Comment by Jeffrey Yemin [ 07/Oct/19 ] | ||||
|
The problem stems from the fact that Document#toJson uses the default DocumentCodec, which is unaware of DBRef (since it's in the bson module, but DBRef is not). I can suggest two workarounds:
or
CC cstrobl | ||||
| Comment by Miika Vesti [ 07/Oct/19 ] | ||||
|
I originally stumbled upon this issue when using Spring-data-mongodb library DATAMONGO-2388 |