| Bug #99603 | Fields function on collections in Java doesn't behave as documented | ||
|---|---|---|---|
| Submitted: | 16 May 2020 16:22 | Modified: | 28 May 2020 15:21 |
| Reporter: | Eric Giguere | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | Connector / J | Severity: | S3 (Non-critical) |
| Version: | 8.0.20 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
[28 May 2020 15:21]
MySQL Verification Team
Hi, Thanks for the report. Verified. kind regards Bogdan

Description: The collection object allow to append a .field() call after a find() to filter out the fields required by the client. These fields as per the documentation should be passed as a list of field names like: .fields("id","description","someOtherField"). In the Java library, this call ends up with a parsing exception for the missing "AS" token. So the way to make it work is: .fields("id as id","description as description","someOtherField as someOtherField"). The AS operator should be optional, supplied only when the client wish to rename it. How to repeat: In the Java library with a collection object: collection.find().fields("id","description","someOtherField"). Suggested fix: Make AS optional