Added interface support for partitioned collections
This commit is contained in:
@@ -18,7 +18,7 @@ namespace IntegrationTests
|
|||||||
public class CreatePartitionedTests : BaseMongoDbRepositoryTests<CreateTestsPartitionedDocument>
|
public class CreatePartitionedTests : BaseMongoDbRepositoryTests<CreateTestsPartitionedDocument>
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void AddOne()
|
public void PartitionedAddOne()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var document = new CreateTestsPartitionedDocument();
|
var document = new CreateTestsPartitionedDocument();
|
||||||
@@ -30,7 +30,7 @@ namespace IntegrationTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task AddOneAsync()
|
public async Task PartitionedAddOneAsync()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var document = new CreateTestsPartitionedDocument();
|
var document = new CreateTestsPartitionedDocument();
|
||||||
@@ -42,7 +42,7 @@ namespace IntegrationTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddMany()
|
public void PartitionedAddMany()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var documents = new List<CreateTestsPartitionedDocument> { new CreateTestsPartitionedDocument(), new CreateTestsPartitionedDocument() };
|
var documents = new List<CreateTestsPartitionedDocument> { new CreateTestsPartitionedDocument(), new CreateTestsPartitionedDocument() };
|
||||||
@@ -54,7 +54,7 @@ namespace IntegrationTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task AddManyAsync()
|
public async Task PartitionedAddManyAsync()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var documents = new List<CreateTestsPartitionedDocument> { new CreateTestsPartitionedDocument(), new CreateTestsPartitionedDocument() };
|
var documents = new List<CreateTestsPartitionedDocument> { new CreateTestsPartitionedDocument(), new CreateTestsPartitionedDocument() };
|
||||||
|
|||||||
@@ -52,69 +52,79 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="id">The Id of the document you want to get.</param>
|
/// <param name="id">The Id of the document you want to get.</param>
|
||||||
Task<TDocument> GetById<TDocument>(Guid id) where TDocument : IDocument;
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
Task<TDocument> GetByIdAsync<TDocument>(Guid id, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asynchronously returns one document given an expression filter.
|
/// Asynchronously returns one document given an expression filter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument;
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns one document given an expression filter.
|
/// Returns one document given an expression filter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument;
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a collection cursor.
|
/// Returns a collection cursor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
IFindFluent<TDocument, TDocument> GetCursor<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument;
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
IFindFluent<TDocument, TDocument> GetCursor<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asynchronously returns true if any of the document of the collection matches the filter condition.
|
/// Asynchronously returns true if any of the document of the collection matches the filter condition.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument;
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if any of the document of the collection matches the filter condition.
|
/// Returns true if any of the document of the collection matches the filter condition.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
bool Any<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument;
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
bool Any<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asynchronously returns a list of the documents matching the filter condition.
|
/// Asynchronously returns a list of the documents matching the filter condition.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument;
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a list of the documents matching the filter condition.
|
/// Returns a list of the documents matching the filter condition.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument;
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Asynchronously counts how many documents match the filter condition.
|
/// Asynchronously counts how many documents match the filter condition.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument;
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Counts how many documents match the filter condition.
|
/// Counts how many documents match the filter condition.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
long Count<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
long Count<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument;
|
||||||
|
|
||||||
#endregion Get
|
#endregion Get
|
||||||
@@ -211,10 +221,11 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="id">The Id of the document you want to get.</param>
|
/// <param name="id">The Id of the document you want to get.</param>
|
||||||
public async Task<TDocument> GetById<TDocument>(Guid id) where TDocument : IDocument
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
public async Task<TDocument> GetByIdAsync<TDocument>(Guid id, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
var filter = Builders<TDocument>.Filter.Eq("Id", id);
|
var filter = Builders<TDocument>.Filter.Eq("Id", id);
|
||||||
return await GetCollection<TDocument>().Find(filter).FirstOrDefaultAsync();
|
return await HandlePartitioned<TDocument>(partitionKey).Find(filter).FirstOrDefaultAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -222,7 +233,8 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
public async Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
public async Task<TDocument> GetOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
return await GetCollection<TDocument>().Find(filter).FirstOrDefaultAsync();
|
return await GetCollection<TDocument>().Find(filter).FirstOrDefaultAsync();
|
||||||
}
|
}
|
||||||
@@ -232,7 +244,8 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
public TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
public TDocument GetOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
return GetCollection<TDocument>().Find(filter).FirstOrDefault();
|
return GetCollection<TDocument>().Find(filter).FirstOrDefault();
|
||||||
}
|
}
|
||||||
@@ -242,7 +255,8 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
public IFindFluent<TDocument, TDocument> GetCursor<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
public IFindFluent<TDocument, TDocument> GetCursor<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
return GetCollection<TDocument>().Find(filter);
|
return GetCollection<TDocument>().Find(filter);
|
||||||
}
|
}
|
||||||
@@ -252,7 +266,8 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
public async Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
public async Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
var count = await GetCollection<TDocument>().CountAsync(filter);
|
var count = await GetCollection<TDocument>().CountAsync(filter);
|
||||||
return (count > 0);
|
return (count > 0);
|
||||||
@@ -263,7 +278,8 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
public bool Any<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
public bool Any<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
var count = GetCollection<TDocument>().Count(filter);
|
var count = GetCollection<TDocument>().Count(filter);
|
||||||
return (count > 0);
|
return (count > 0);
|
||||||
@@ -274,7 +290,8 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
public async Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
public async Task<List<TDocument>> GetAllAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
return await GetCollection<TDocument>().Find(filter).ToListAsync();
|
return await GetCollection<TDocument>().Find(filter).ToListAsync();
|
||||||
}
|
}
|
||||||
@@ -284,7 +301,8 @@ namespace MongoDbGenericRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
public List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
public List<TDocument> GetAll<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
return GetCollection<TDocument>().Find(filter).ToList();
|
return GetCollection<TDocument>().Find(filter).ToList();
|
||||||
}
|
}
|
||||||
@@ -295,7 +313,7 @@ namespace MongoDbGenericRepository
|
|||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter">A LINQ expression filter.</param>
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
/// <param name="partitionKey">An optional partitionKey</param>
|
/// <param name="partitionKey">An optional partitionKey</param>
|
||||||
public async Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
public async Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
return await GetCollection<TDocument>().CountAsync(filter);
|
return await GetCollection<TDocument>().CountAsync(filter);
|
||||||
}
|
}
|
||||||
@@ -318,7 +336,8 @@ namespace MongoDbGenericRepository
|
|||||||
/// <param name="filter"></param>
|
/// <param name="filter"></param>
|
||||||
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
|
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
|
||||||
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
|
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
|
||||||
public async Task<List<TDocument>> GetPaginatedAsync<TDocument>(Expression<Func<TDocument, bool>> filter, int skipNumber = 0, int takeNumber = 50) where TDocument : IDocument
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
public async Task<List<TDocument>> GetPaginatedAsync<TDocument>(Expression<Func<TDocument, bool>> filter, int skipNumber = 0, int takeNumber = 50, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
return await GetCollection<TDocument>().Find(filter).Skip(skipNumber).Limit(takeNumber).ToListAsync();
|
return await GetCollection<TDocument>().Find(filter).Skip(skipNumber).Limit(takeNumber).ToListAsync();
|
||||||
}
|
}
|
||||||
@@ -330,7 +349,7 @@ namespace MongoDbGenericRepository
|
|||||||
/// <typeparam name="TDocument">T is a DbEntity</typeparam>
|
/// <typeparam name="TDocument">T is a DbEntity</typeparam>
|
||||||
/// <typeparam name="TProjection"></typeparam>
|
/// <typeparam name="TProjection"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<TProjection> ProjectBy<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection)
|
public async Task<TProjection> ProjectBy<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey = null)
|
||||||
where TDocument : IDocument
|
where TDocument : IDocument
|
||||||
where TProjection : class, new()
|
where TProjection : class, new()
|
||||||
{
|
{
|
||||||
@@ -371,7 +390,7 @@ namespace MongoDbGenericRepository
|
|||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter"></param>
|
/// <param name="filter"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
public long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
return GetCollection<TDocument>().DeleteOne(filter).DeletedCount;
|
return GetCollection<TDocument>().DeleteOne(filter).DeletedCount;
|
||||||
}
|
}
|
||||||
@@ -382,7 +401,7 @@ namespace MongoDbGenericRepository
|
|||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter"></param>
|
/// <param name="filter"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
public async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
return (await GetCollection<TDocument>().DeleteOneAsync(filter)).DeletedCount;
|
return (await GetCollection<TDocument>().DeleteOneAsync(filter)).DeletedCount;
|
||||||
}
|
}
|
||||||
@@ -393,7 +412,7 @@ namespace MongoDbGenericRepository
|
|||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter"></param>
|
/// <param name="filter"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
public async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
var deleteRes = await GetCollection<TDocument>().DeleteManyAsync(filter);
|
var deleteRes = await GetCollection<TDocument>().DeleteManyAsync(filter);
|
||||||
return deleteRes.DeletedCount;
|
return deleteRes.DeletedCount;
|
||||||
@@ -439,7 +458,7 @@ namespace MongoDbGenericRepository
|
|||||||
/// <typeparam name="TDocument"></typeparam>
|
/// <typeparam name="TDocument"></typeparam>
|
||||||
/// <param name="filter"></param>
|
/// <param name="filter"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter) where TDocument : IDocument
|
public long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
|
||||||
{
|
{
|
||||||
var deleteRes = GetCollection<TDocument>().DeleteMany(filter);
|
var deleteRes = GetCollection<TDocument>().DeleteMany(filter);
|
||||||
return deleteRes.DeletedCount;
|
return deleteRes.DeletedCount;
|
||||||
|
|||||||
Reference in New Issue
Block a user