I looked up a way to work with mongodb's UpdateDefinitionBuilders
but the documentation doesn't really show much...
I need to be able to dynamically build my update queries, so I thought about doing it like this:
var update = Builders<Product>.Update;
update.Set("add A update");
if ()
update.Set("add X update");
else
update.Set("add Y update");
update.Set("add B update");
if ()
update.Set("add Z update");
else
update.Set("add P update");
Collection.UpdateOneAsync(filter, update, updateOptions);
But it gives a compilation error:
cannot convert from UpdateDefinitionBuilder UpdateDefinition
I looked, but couldn't find, a solution how to works with this UpdateDefinitionBuilders
Can someone please give a code sample of how to use this class?