|
@@ -114,33 +114,6 @@ namespace Business.Core.MongoDBHelper
|
|
|
return mongoCollection.Find(filter).ToListAsync();
|
|
return mongoCollection.Find(filter).ToListAsync();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /// <summary>
|
|
|
|
|
- /// 根据id删除数据
|
|
|
|
|
- /// </summary>
|
|
|
|
|
- /// <returns></returns>
|
|
|
|
|
- public Task DeleteByIds(long id)
|
|
|
|
|
- {
|
|
|
|
|
- return mongoCollection.DeleteOneAsync(p => p.Id == id);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /// <summary>
|
|
|
|
|
- /// 根据条件删除数据
|
|
|
|
|
- /// </summary>
|
|
|
|
|
- /// <returns></returns>
|
|
|
|
|
- public Task DeleteManyByIds(FilterDefinition<T> filter)
|
|
|
|
|
- {
|
|
|
|
|
- return mongoCollection.DeleteManyAsync(filter);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /// <summary>
|
|
|
|
|
- /// 根据条件删除数据
|
|
|
|
|
- /// </summary>
|
|
|
|
|
- /// <returns></returns>
|
|
|
|
|
- public Task DeleteManyByCondition(Expression<Func<T, bool>> filter)
|
|
|
|
|
- {
|
|
|
|
|
- return mongoCollection.DeleteManyAsync(filter);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 根据id删除对象
|
|
/// 根据id删除对象
|
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -151,7 +124,7 @@ namespace Business.Core.MongoDBHelper
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
- /// 根据id列表批量删除 对象
|
|
|
|
|
|
|
+ /// 根据id列表批量删除对象
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <param name="ids">id列表</param>
|
|
/// <param name="ids">id列表</param>
|
|
|
public Task DeleteByIds(IEnumerable<long> ids)
|
|
public Task DeleteByIds(IEnumerable<long> ids)
|
|
@@ -159,6 +132,12 @@ namespace Business.Core.MongoDBHelper
|
|
|
return mongoCollection.DeleteManyAsync(s => ids.Contains(s.Id));
|
|
return mongoCollection.DeleteManyAsync(s => ids.Contains(s.Id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 删除数据
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="expression"></param>
|
|
|
|
|
+ /// <param name="isOne"></param>
|
|
|
|
|
+ /// <returns></returns>
|
|
|
public Task<DeleteResult> Delete(Expression<Func<T, bool>> expression, bool isOne = false)
|
|
public Task<DeleteResult> Delete(Expression<Func<T, bool>> expression, bool isOne = false)
|
|
|
{
|
|
{
|
|
|
if (isOne)
|
|
if (isOne)
|
|
@@ -167,6 +146,12 @@ namespace Business.Core.MongoDBHelper
|
|
|
return mongoCollection.DeleteManyAsync(expression);
|
|
return mongoCollection.DeleteManyAsync(expression);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 删除数据
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="filter"></param>
|
|
|
|
|
+ /// <param name="isOne"></param>
|
|
|
|
|
+ /// <returns></returns>
|
|
|
public Task<DeleteResult> Delete(FilterDefinition<T> filter, bool isOne = false)
|
|
public Task<DeleteResult> Delete(FilterDefinition<T> filter, bool isOne = false)
|
|
|
{
|
|
{
|
|
|
if (isOne)
|
|
if (isOne)
|