예제 #1
0
        public void Update(MealPlan plan)
        {
            var filter = Builders <BsonDocument> .Filter.Eq("ID", plan.ID);

            var option = new UpdateOptions();

            option.IsUpsert = true;
            var result = _collection.ReplaceOne(filter, plan.ToBsonDocument(), option);
        }
예제 #2
0
 public MealPlan Save(MealPlan plan)
 {
     plan.ID = MongoBase.AutoID("mealplan");
     _collection.InsertOne(plan.ToBsonDocument());
     return(plan);
 }