[JAVA-2877] Query generated by Filters.not is not always valid Created: 31/May/18 Updated: 28/Oct/23 Resolved: 21/Nov/18 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Builders |
| Affects Version/s: | 3.7.1 |
| Fix Version/s: | 3.9.1, 3.10.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Boris Petrov | Assignee: | Ross Lawley |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | newgrad | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
This code generates the query:
Which after that complains with: com.mongodb.MongoQueryException: Query failed with error code 2 and error message 'unknown operator: $ref' on server localhost:27017 When passed to the DB. Am I missing something or is this a bug? |
| Comments |
| Comment by Githook User [ 14/Jan/19 ] | |||
|
Author: {'username': 'rozza', 'email': 'ross.lawley@gmail.com', 'name': 'Ross Lawley'}Message: Support DBRef documents in Filters.not
| |||
| Comment by Githook User [ 21/Nov/18 ] | |||
|
Author: {'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}Message: Support DBRef documents in Filters.not
| |||
| Comment by Githook User [ 21/Nov/18 ] | |||
|
Author: {'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}Message: Support DBRef documents in Filters.not
| |||
| Comment by Jeffrey Yemin [ 31/May/18 ] | |||
|
Alternatively, you can use the $ne operator:
| |||
| Comment by Jeffrey Yemin [ 31/May/18 ] | |||
|
Hi Boris, Thanks for the report. This looks like a bug in the Filters#not method, where it's not inserting a $eq between the $not and the DBRef document. For now you can work around it by using the Document class to construct the query:
|