[CSHARP-2727] PredicateTranslator.TranslatePipelineContains fails to parse MethodCallExpression Created: 04/Sep/19 Updated: 28/Oct/23 Resolved: 22/Nov/22 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Linq |
| Affects Version/s: | 2.8.0, 2.9.1 |
| Fix Version/s: | 2.18.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Bohdan Kobel | Assignee: | Robert Stam |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 10, Azure Cosmos DB Emulator. |
||
| Description |
|
I need to perform search on the documents with a field in range of specific values. Having following model:
With counterpart in DB:
But when I try to perform search on Body contained properties (as below) - ArgumentException is being thrown:
Exception details:
Taking a brief glance at PredicateTranslator, discovered that TranslatePipelineContains accepts one side of expression only as IFieldExpression. But since I'm using BsonDocument's accessor to retrieve property - MethodCallExpression is being passed: |
| Comments |
| Comment by Githook User [ 23/Nov/22 ] | ||||
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: | ||||
| Comment by Robert Stam [ 22/Nov/22 ] | ||||
|
This issue has been fixed in the new LINQ provider (known as LINQ3), which was introduced in the 2.14 release. Configure your MongoClientSettings to use LinqProvider.V3 if you want to use this functionality. To configure a client to use the LINQ3 provider use code like the following
| ||||
| Comment by Githook User [ 22/Nov/22 ] | ||||
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |