[CSHARP-4622] Error with MongoDB .NET driver 2.19.0: $expr not allowed in query predicate for upsert Created: 19/Apr/23 Updated: 28/Oct/23 Resolved: 05/May/23 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | LINQ3 |
| Affects Version/s: | None |
| Fix Version/s: | 2.19.2 |
| Type: | Bug | Priority: | Blocker - P1 |
| Reporter: | Hardik Shah | Assignee: | Oleksandr Poliakov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | triage | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Documentation Changes: | Not Needed |
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
| Description |
|
I am encountering an issue with the latest version (2.19.0) of the MongoDB .NET driver. When performing an upsert operation using the ReplaceOneAsync method with an Expression<Func<T, bool>> filter that always returns true, the following error occurs: MongoDB.Driver.MongoWriteException: A write operation resulted in an error. WriteError: { Category : "Uncategorized", Code : 224, Message : "$expr is not allowed in the query predicate for an upsert" }. This error was not present in the previous version (2.18.0) of the MongoDB .NET driver. Steps to Reproduce: > Use the latest version (2.19.0) of the MongoDB .NET driver. Expected Result: Actual Result: Environment: MongoDB .NET driver version: 2.19.0 Code snippet: // genric library code ; return null; |
| Comments |
| Comment by Githook User [ 18/May/23 ] | |||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Oleksandr Poliakov', 'email': '31327136+sanych-sun@users.noreply.github.com', 'username': 'sanych-sun'}Message: | |||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 05/May/23 ] | |||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Oleksandr Poliakov', 'email': '31327136+sanych-sun@users.noreply.github.com', 'username': 'sanych-sun'}Message: | |||||||||||||||||||||||||||||||||||||
| Comment by Hardik Shah [ 24/Apr/23 ] | |||||||||||||||||||||||||||||||||||||
|
Sample C# code to replicate the issue:
|