[JAVA-2672] collection.distinct().batchCursor() does not decode results Created: 20/Nov/17  Updated: 27/Oct/23  Resolved: 21/Nov/17

Status: Closed
Project: Java Driver
Component/s: Command Operations
Affects Version/s: 3.5.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Marc Knaup Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I'm using the following code to get distinct values of a specific type asynchronously:

collection.distinct("fieldName", SomeType.class).batchCursor(…)

The problem is that even though the result is declared as AsyncBatchCursor<SomeType> the actual values are of type String because the respective codec was never applied.

After debugging a lot I've figured out that DistinctOperation.asyncTransformer() doesn't use the supplied decoder at all.



 Comments   
Comment by Jeffrey Yemin [ 21/Nov/17 ]

No worries. Closing.

Comment by Marc Knaup [ 21/Nov/17 ]

I've found the root cause of the issue outside of the Java driver so this issue can be closed.
I'm really sorry for wasting your time here.

Comment by Jeffrey Yemin [ 20/Nov/17 ]

There's a test that demonstrates that it works as specified.

DistinctOperation doesn't use the supplied decoder directly, instead delegating to com.mongodb.operation.CommandResultDocumentCodec.

Can you provide a small test program that reproduces the problem?

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