I have a MongoDB collection in the following format:
{ "_id" : ObjectId("5692a3397d7518330416f8e5"), "supertagname" : "xxx", "inclusions" : [ "test", "blabla" ], "exclusions" : [ ] }
and I'm trying to query for all documents where the "inclusion" array contains the value I'm looking for. Here is the code
string t = "blabla"; // the string value I am looking for filter = Builders<BsonDocument>.Filter.ElemMatch( "inclusions", Builders<BsonDocument>.Filter.Eq("inclusions", t)); var matches = dictCollection.Find(filter).ToList(); foreach (BsonDocument doc in matches) {}
matches.count always 0. What am I doing wrong?
thanks
source share