int SaveOrUpdate <T>(MongoDBEntity obj) { var collection = GetCollection <MongoDBEntity>(this.server, dbName, typeof(T).Name); return((int)collection.ReplaceOne(c => c._id == obj._id, obj, new UpdateOptions { IsUpsert = true }).MatchedCount); }
int Delete <T>(MongoDBEntity obj) { var collection = GetCollection <MongoDBEntity>(this.server, dbName, typeof(T).Name); return((int)collection.DeleteOne(c => c._id == obj._id).DeletedCount); }
int Update <T>(MongoDBEntity obj) { var collection = GetCollection <MongoDBEntity>(this.server, dbName, typeof(T).Name); return((int)collection.ReplaceOne(c => c._id == obj._id, obj).MatchedCount); }