Compare a field in a BsonDocument to a string doesn't work

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: LINQ3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

                 var result = Builders<BsonDocument>.Filter.Where(x => x["_id"] != "");
                  var registry = BsonSerializer.SerializerRegistry;
                  var serializer = registry.GetSerializer<BsonDocument>();
                  var mql = result.Render(serializer, registry, Linq.LinqProvider.V3); 

      The above code triggers exception:

      MongoDB.Driver.Linq.ExpressionNotSupportedException: 'Expression not supported: (x.get_Item("_id") != ).' 

      in this line https://github.com/mongodb/mongo-csharp-driver/blob/88769e2bd8866abd40c274552e38127400a0e731/src/MongoDB.Driver/Linq/Linq3Implementation/Translators/ExpressionToFilterTranslators/ExpressionTranslators/StringExpressionToRegexFilterTranslator.cs#L305.

            Assignee:
            Robert Stam (Inactive)
            Reporter:
            Dmitry Lukyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: