CK-Yong / gaip-net

Library for implementing Google Api Improvement Proposals in C#
MIT License
2 stars 1 forks source link

Bug: Has operator does not work with string elements (Mongo Adapter) #35

Closed CK-Yong closed 2 years ago

CK-Yong commented 2 years ago

Consider the following document:

{
    "strings": [
        "foo",
        "bar"
    ]
}

I expect to be able to query it with this:

strings:foo

But this results in the following query:

{ strings: {$elemMatch: {$eq: foo }}}

I expect it as follows:

{ strings: {$elemMatch: {$eq: "foo" }}}

So now it throws the following exception:

InvalidCastException: Unable to cast object of type 'MongoDB.Bson.Serialization.Serializers.StringSerializer' to type 'MongoDB.Bson.Serialization.IBsonSerializer`1[System.Object]'."