Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4546

Expression not supported: Convert Error on linq3

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.19.0
    • Component/s: LINQ3
    • None
    • Hide

      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?

      Show
      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?

      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

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            1213431370@qq.com JiaWei He
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: