How can I implement a typed Builder
using string
fieldname
and value
, like in the following code:
Builders<Profile>.Filter.Eq(fieldName, value)
I can implement it with BsonDocument
data type, but I need to retrieve a typed Profile
FilterDifinition
.
There's an implicit conversion from string
to FilterDefinition
so you can use it just like you did. For example:
var profile = await collection.Find(Builders<Profile>.Filter.Eq("Name", "bar")).SingleAsync();