/// <summary>
        /// 更新
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="predicate">条件</param>
        /// <param name="lambda">实体</param>
        /// <returns></returns>
        public async Task <long> UpdateAsync <T>(Expression <Func <T, bool> > predicate, Expression <Func <T, T> > lambda) where T : MongoEntity
        {
            var coll = GetCollection <T>();

            var updateDefinitionList = MongoExpression <T> .GetUpdateDefinition(lambda);

            var updateDefinitionBuilder = new UpdateDefinitionBuilder <T>().Combine(updateDefinitionList);

            var result = await coll.UpdateManyAsync <T>(predicate, updateDefinitionBuilder);

            return(result.ModifiedCount);
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="database">库</param>
        /// <param name="collection">集合</param>
        /// <param name="whereExpression">条件</param>
        /// <param name="updateExpression"></param>
        /// <returns></returns>
        public long Update <T>(string database, string collection, Expression <Func <T, bool> > whereExpression, Expression <Func <T, T> > updateExpression) where T : MongoEntity
        {
            var coll = GetCollection <T>(database, collection);

            var updateDefinitionList = MongoExpression <T> .GetUpdateDefinition(updateExpression);

            var updateDefinitionBuilder = new UpdateDefinitionBuilder <T>().Combine(updateDefinitionList);

            var result = coll.UpdateMany <T>(whereExpression, updateDefinitionBuilder);

            return(result.ModifiedCount);
        }
        /// <summary>
        /// 按条件查询条数
        /// </summary>
        /// <param name="predicate">条件</param>
        /// <param name="updateExpression">更新结果</param>
        /// <returns></returns>
        public T GetAndUpdate <T>(Expression <Func <T, bool> > predicate, Expression <Func <T, T> > updateExpression)
        {
            var coll = GetCollection <T>();

            var updateDefinitionList = MongoExpression <T> .GetUpdateDefinition(updateExpression);

            var updateDefinitionBuilder = new UpdateDefinitionBuilder <T>().Combine(updateDefinitionList);

            return(coll.FindOneAndUpdate(predicate, updateDefinitionBuilder, new FindOneAndUpdateOptions <T, T>
            {
                ReturnDocument = ReturnDocument.After
            }));
        }
        /// <summary>
        /// 查询出更新结果
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="database"></param>
        /// <param name="collection"></param>
        /// <param name="predicate"></param>
        /// <param name="updateExpression"></param>
        /// <returns></returns>
        public T GetAndUpdate <T>(string database, string collection, Expression <Func <T, bool> > predicate, Expression <Func <T, T> > updateExpression)
        {
            var db  = _mongoClient.GetDatabase(database);
            var col = db.GetCollection <T>(collection);

            var updateDefinitionList = MongoExpression <T> .GetUpdateDefinition(updateExpression);

            var updateDefinitionBuilder = new UpdateDefinitionBuilder <T>().Combine(updateDefinitionList);

            return(col.FindOneAndUpdate(predicate, updateDefinitionBuilder, new FindOneAndUpdateOptions <T, T>
            {
                ReturnDocument = ReturnDocument.After
            }));
        }