I have a mongo collection (of <BsonDocument>) who could look like this:
{
"someProperty1": "someValue1",
"users": [
{ "name": "[email protected]", "displayName" : "Sample User" }
{ "name": "[email protected]", "displayName" : "Another User" }
]
},
"someProperty2": "someValue2",
"users": [
{ "name": "[email protected]", "displayName" : "Test User" },
{ "name": "[email protected]", "displayName" : "Another User" },
]
},
"someProperty3": "someValue3",
"users": [
{ "name": "[email protected]", "displayName" : "Another User" }
]
}
I want to filter with an IEnumerable of strings, that contains a set of name and want to get every document where at least one of the names in users is matching.
For example i would have Array filterArray with the following Value:
["[email protected]", "[email protected]"]
with this i want to build a FilterDefinition filter and after appling it:
await mongoColletion.Find(filter).ToListAsync()
It should have the following output (as IEnumerable<BsonDocument>):
[
{
"someProperty1": "someValue1",
"users": [
{ "name": "[email protected]", "displayName" : "Sample User" }
{ "name": "[email protected]", "displayName" : "Another User" }
]
},
"someProperty2": "someValue2",
"users": [
{ "name": "[email protected]", "displayName" : "Test User" },
{ "name": "[email protected]", "displayName" : "Another User" },
]
}
]
How can I build this FilterDefinition?