0

Maybe it is a simple question, but I stack on it and cannot go ahead.

I need to make a query to MongoDb via C# driver. I can easily generate a complex filter by using FilterDefinition myFilter ...

new FilterDefinition<BsonDocument> myFilter = { "$and": [{ "D20": { "$in": [1654, 1659 ] } }, { "D22": 1666 }] }; //That is just sample, creating filter logic more complex

But when I need to edit it and remove some clause(for ex { "D22": 1666 }) from it, don't have any clue how to do this by using only FilterDefinition, without converting to json or string.

user1542557
  • 181
  • 1
  • 1
  • 4

1 Answers1

0

Try this

var filter = Builders<BsonDocument>.Filter.Eq("name", value);
var update = Builders<BsonDocument>.Update.Set("Name", new value);
collection.UpdateOne(filter, update);
Marcolia
  • 40
  • 6