[CSHARP-4546] Expression not supported: Convert Error on linq3 Created: 25/Feb/23  Updated: 28/Feb/23  Resolved: 28/Feb/23

Status: Closed
Project: C# Driver
Component/s: LINQ3
Affects Version/s: 2.19.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: JiaWei He Assignee: Robert Stam
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CSHARP-4499 Support Convert calls to a base type ... Closed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Summary

I can do this like on linq2 but error on linq3

public Task<long> UpdateEntityAsync(long id, Expression<Func<T, object>> exp, object value, Dictionary<string, object> update, MonTrans? monTrans = null, UpdateOptions? options = null)
{
   var filter = Builders<T>.Filter.And(GetPkMatch(id), Builders<T>.Filter.Eq(exp, value));
   var res = await collection.UpdateOneAsync(filter, new BsonDocument("$set", new BsonDocument(update), options));
   return res.ModifiedCount;
}

I just need the object type can convert to well-known framework types and i can use by expression

 

 

MongoDB Driver Version: 2.19.0

MongoDB Version: 6.0 replica



 Comments   
Comment by Robert Stam [ 28/Feb/23 ]

Thank you for reporting this issue. This looks like the same issue that was fixed in CSHARP-4499.

Generated at Wed Feb 07 21:48:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.