Hi, I’m trying to replicate this mongo query using the C# driver:
.findOneAndUpdate({_id: id},[{$set:{present:{$eq:[false,"$present"]}}}]);
What would be the recommended way to write this query? So far the best solution I’ve come up with involves magic strings:
var pipeline = new EmptyPipelineDefinition<T>()
.AppendStage("{$set:{Present:{$eq:[false,\"$Present\"]}}}",
BsonSerializer.LookupSerializer<T>());
collection.FindOneAndUpdateAsync(x => x.Id == id, Builders<T>.Update.Pipeline(pipeline));
Thanks!