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