public virtual TEntity FindOneAndUpdateInc(Expression <Func <TEntity, bool> > filter, Dictionary <Expression <Func <TEntity, object> >, object> updates) { var ups = updates.Select(upitem => Builders <TEntity> .Update.Inc(upitem.Key, upitem.Value)).ToList(); var options = new FindOneAndUpdateOptions <TEntity, TEntity> { ReturnDocument = ReturnDocument.After }; return(PrimaryMongoCollection.FindOneAndUpdate(SoftFilter(filter), Builders <TEntity> .Update.Combine(ups), options: options)); }
public virtual TEntity FindOneAndUpdate(Expression <Func <TEntity, bool> > filter, Dictionary <Expression <Func <TEntity, object> >, object> updates) { var ups = updates.Select(upitem => Builders <TEntity> .Update.Set(upitem.Key, upitem.Value)).ToList(); return(PrimaryMongoCollection.FindOneAndUpdate(SoftFilter(filter), Builders <TEntity> .Update.Combine(ups))); }