public void DeleteMongoSensor(MongoSensor mongoSensor) { IMongoCollection<BsonDocument> sensorsCollection = GetMongoCollection("sensors"); FilterDefinition<BsonDocument> filter = Builders<BsonDocument>.Filter.Eq("_id", mongoSensor.objId); sensorsCollection.DeleteOneAsync(filter); }
public void SaveMongoSensor(MongoSensor mongoSensor) { IMongoCollection<BsonDocument> sensorsCollection = GetMongoCollection("sensors"); sensorsCollection.ReplaceOneAsync(bsonDocument => bsonDocument["_id"] == mongoSensor.objId, mongoSensor.ToBsonDocument(), new UpdateOptions {IsUpsert = true}); }