diff --git a/MongoDbGenericRepository/Abstractions/IBaseMongoRepository.cs b/MongoDbGenericRepository/Abstractions/IBaseMongoRepository.cs
index 64d9e99..9f7b39f 100644
--- a/MongoDbGenericRepository/Abstractions/IBaseMongoRepository.cs
+++ b/MongoDbGenericRepository/Abstractions/IBaseMongoRepository.cs
@@ -8,604 +8,12 @@ using System.Linq;
namespace MongoDbGenericRepository
{
-
///
/// The IBaseMongoRepository exposes the CRUD functionality of the BaseMongoRepository.
///
- public interface IBaseMongoRepository : IReadOnlyMongoRepository, IMongoDbCollectionIndexRepository
+ public interface IBaseMongoRepository : IReadOnlyMongoRepository, IBaseMongoRepository_Create, IBaseMongoRepository_Update, IBaseMongoRepository_Delete, IBaseMongoRepository_Index
{
- #region Create
- ///
- /// Asynchronously adds a document to the collection.
- ///
- /// The type representing a Document.
- /// The document you want to add.
- Task AddOneAsync(TDocument document) where TDocument : IDocument;
-
- ///
- /// Adds a document to the collection.
- /// Populates the Id and AddedAtUtc fields if necessary.
- ///
- /// The type representing a Document.
- /// The document you want to add.
- void AddOne(TDocument document) where TDocument : IDocument;
-
- ///
- /// Asynchronously adds a list of documents to the collection.
- /// Populates the Id and AddedAtUtc fields if necessary.
- ///
- /// The type representing a Document.
- /// The document you want to add.
- Task AddManyAsync(IEnumerable documents) where TDocument : IDocument;
-
- ///
- /// Adds a list of documents to the collection.
- /// Populates the Id and AddedAtUtc fields if necessary.
- ///
- /// The type representing a Document.
- /// The document you want to add.
- void AddMany(IEnumerable documents) where TDocument : IDocument;
-
- #endregion
-
- #region Create TKey
-
- ///
- /// Asynchronously adds a document to the collection.
- /// Populates the Id and AddedAtUtc fields if necessary.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The document you want to add.
- Task AddOneAsync(TDocument document)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Adds a document to the collection.
- /// Populates the Id and AddedAtUtc fields if necessary.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The document you want to add.
- void AddOne(TDocument document)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Asynchronously adds a list of documents to the collection.
- /// Populates the Id and AddedAtUtc fields if necessary.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The documents you want to add.
- Task AddManyAsync(IEnumerable documents)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Adds a list of documents to the collection.
- /// Populates the Id and AddedAtUtc fields if necessary.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The documents you want to add.
- void AddMany(IEnumerable documents)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- #endregion
-
- #region Update
-
- ///
- /// Asynchronously Updates a document.
- ///
- /// The type representing a Document.
- /// The document with the modifications you want to persist.
- Task UpdateOneAsync(TDocument modifiedDocument) where TDocument : IDocument;
-
- ///
- /// Updates a document.
- ///
- /// The type representing a Document.
- /// The document with the modifications you want to persist.
- bool UpdateOne(TDocument modifiedDocument) where TDocument : IDocument;
-
- ///
- /// Updates the property field with the given value update a property field in entities.
- ///
- /// The type representing a Document.
- /// The type of the field.
- /// The document filter.
- /// The field selector.
- /// The new value of the property field.
- /// The value of the partition key.
- bool UpdateOne(FilterDefinition filter, Expression> field, TField value, string partitionKey = null)
- where TDocument : IDocument;
-
- ///
- /// Updates the property field with the given value update a property field in entities.
- ///
- /// The type representing a Document.
- /// The type of the field.
- /// The document filter.
- /// The field selector.
- /// The new value of the property field.
- /// The value of the partition key.
- Task UpdateOneAsync(FilterDefinition filter, Expression> field, TField value, string partitionKey = null)
- where TDocument : IDocument;
-
- ///
- /// Updates the property field with the given value update a property field in entities.
- ///
- /// The type representing a Document.
- /// The type of the field.
- /// The document you want to modify.
- /// The field selector.
- /// The new value of the property field.
- bool UpdateOne(TDocument documentToModify, Expression> field, TField value)
- where TDocument : IDocument;
-
- ///
- /// Updates the property field with the given value update a property field in entities.
- ///
- /// The type representing a Document.
- /// The type of the field.
- /// The document you want to modify.
- /// The field selector.
- /// The new value of the property field.
- Task UpdateOneAsync(TDocument documentToModify, Expression> field, TField value)
- where TDocument : IDocument;
-
- ///
- /// For the entity selected by the filter, updates the property field with the given value.
- ///
- /// The type representing a Document.
- /// The type of the field.
- /// The document filter.
- /// The field selector.
- /// The new value of the property field.
- /// The partition key for the document.
- bool UpdateOne(Expression> filter, Expression> field, TField value, string partitionKey = null)
- where TDocument : IDocument;
-
- ///
- /// Takes a document you want to modify and applies the update you have defined in MongoDb.
- ///
- /// The type representing a Document.
- /// The document you want to modify.
- /// The update definition for the document.
- Task UpdateOneAsync(TDocument documentToModify, UpdateDefinition update)
- where TDocument : IDocument;
-
- ///
- /// For the entity selected by the filter, updates the property field with the given value.
- ///
- /// The type representing a Document.
- /// The type of the field.
- /// The document filter.
- /// The field selector.
- /// The new value of the property field.
- /// The partition key for the document.
- Task UpdateOneAsync(Expression> filter, Expression> field, TField value, string partitionKey = null)
- where TDocument : IDocument;
-
- ///
- /// Takes a document you want to modify and applies the update you have defined in MongoDb.
- ///
- /// The type representing a Document.
- /// The document you want to modify.
- /// The update definition for the document.
- bool UpdateOne(TDocument documentToModify, UpdateDefinition update)
- where TDocument : IDocument;
-
- #endregion
-
- #region Update TKey
-
- ///
- /// Asynchronously Updates a document.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The document with the modifications you want to persist.
- Task UpdateOneAsync(TDocument modifiedDocument)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Updates a document.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The document with the modifications you want to persist.
- bool UpdateOne(TDocument modifiedDocument)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Takes a document you want to modify and applies the update you have defined in MongoDb.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The document you want to modify.
- /// The update definition for the document.
- Task UpdateOneAsync(TDocument documentToModify, UpdateDefinition update)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Takes a document you want to modify and applies the update you have defined in MongoDb.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The document you want to modify.
- /// The update definition for the document.
- bool UpdateOne(TDocument documentToModify, UpdateDefinition update)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// For the entity selected by the filter, updates the property field with the given value..
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type of the field.
- /// The document filter.
- /// The field selector.
- /// The new value of the property field.
- /// The partition key for the document.
- bool UpdateOne(Expression> filter, Expression> field, TField value, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Updates the property field with the given value update a property field in entities.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type of the field.
- /// The document you want to modify.
- /// The field selector.
- /// The new value of the property field.
- Task UpdateOneAsync(TDocument documentToModify, Expression> field, TField value)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// For the entity selected by the filter, updates the property field with the given value.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type of the field.
- /// The document filter.
- /// The field selector.
- /// The new value of the property field.
- /// The partition key for the document.
- Task UpdateOneAsync(Expression> filter, Expression> field, TField value, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Updates the property field with the given value update a property field in entities.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type of the field.
- /// The document you want to modify.
- /// The field selector.
- /// The new value of the property field.
- bool UpdateOne(TDocument documentToModify, Expression> field, TField value)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Updates the property field with the given value update a property field in entities.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type of the field.
- /// The document filter.
- /// The field selector.
- /// The new value of the property field.
- /// The value of the partition key.
- Task UpdateOneAsync(FilterDefinition filter, Expression> field, TField value, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Updates the property field with the given value update a property field in entities.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type of the field.
- /// The document filter.
- /// The field selector.
- /// The new value of the property field.
- /// The value of the partition key.
- bool UpdateOne(FilterDefinition filter, Expression> field, TField value, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- #endregion
-
- #region Delete
-
- ///
- /// Asynchronously deletes a document.
- ///
- /// The type representing a Document.
- /// The document you want to delete.
- /// The number of documents deleted.
- Task DeleteOneAsync(TDocument document) where TDocument : IDocument;
-
- ///
- /// Asynchronously deletes a document matching the condition of the LINQ expression filter.
- ///
- /// The type representing a Document.
- /// A LINQ expression filter.
- /// An optional partition key.
- /// The number of documents deleted.
- Task DeleteOneAsync(Expression> filter, string partitionKey = null) where TDocument : IDocument;
-
- ///
- /// Deletes a document.
- ///
- /// The type representing a Document.
- /// The document you want to delete.
- /// The number of documents deleted.
- long DeleteOne(TDocument document) where TDocument : IDocument;
-
- ///
- /// Deletes a document matching the condition of the LINQ expression filter.
- ///
- /// The type representing a Document.
- /// A LINQ expression filter.
- /// An optional partition key.
- /// The number of documents deleted.
- long DeleteOne(Expression> filter, string partitionKey = null) where TDocument : IDocument;
-
- ///
- /// Asynchronously deletes the documents matching the condition of the LINQ expression filter.
- ///
- /// The type representing a Document.
- /// A LINQ expression filter.
- /// An optional partition key.
- /// The number of documents deleted.
- Task DeleteManyAsync(Expression> filter, string partitionKey = null) where TDocument : IDocument;
-
- ///
- /// Asynchronously deletes a list of documents.
- ///
- /// The type representing a Document.
- /// The list of documents to delete.
- /// The number of documents deleted.
- Task DeleteManyAsync(IEnumerable documents) where TDocument : IDocument;
-
- ///
- /// Deletes a list of documents.
- ///
- /// The type representing a Document.
- /// The list of documents to delete.
- /// The number of documents deleted.
- long DeleteMany(IEnumerable documents) where TDocument : IDocument;
-
- ///
- /// Deletes the documents matching the condition of the LINQ expression filter.
- ///
- /// The type representing a Document.
- /// A LINQ expression filter.
- /// An optional partition key.
- /// The number of documents deleted.
- long DeleteMany(Expression> filter, string partitionKey = null) where TDocument : IDocument;
-
- #endregion
-
- #region Delete TKey
-
- ///
- /// Deletes a document.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The document you want to delete.
- /// The number of documents deleted.
- long DeleteOne(TDocument document)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Asynchronously deletes a document matching the condition of the LINQ expression filter.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The document you want to delete.
- /// The number of documents deleted.
- Task DeleteOneAsync(TDocument document)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Deletes a document matching the condition of the LINQ expression filter.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// A LINQ expression filter.
- /// An optional partition key.
- /// The number of documents deleted.
- long DeleteOne(Expression> filter, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Asynchronously deletes a document matching the condition of the LINQ expression filter.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// A LINQ expression filter.
- /// An optional partition key.
- /// The number of documents deleted.
- Task DeleteOneAsync(Expression> filter, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Asynchronously deletes the documents matching the condition of the LINQ expression filter.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// A LINQ expression filter.
- /// An optional partition key.
- /// The number of documents deleted.
- Task DeleteManyAsync(Expression> filter, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Asynchronously deletes a list of documents.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The list of documents to delete.
- /// The number of documents deleted.
- Task DeleteManyAsync(IEnumerable documents)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Deletes a list of documents.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The list of documents to delete.
- /// The number of documents deleted.
- long DeleteMany(IEnumerable documents)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- ///
- /// Deletes the documents matching the condition of the LINQ expression filter.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// A LINQ expression filter.
- /// An optional partition key.
- /// The number of documents deleted.
- long DeleteMany(Expression> filter, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable;
-
- #endregion
-
- #region Project
-
- ///
- /// Asynchronously returns a projected document matching the filter condition.
- ///
- /// The type representing a Document.
- /// The type representing the model you want to project to.
- ///
- /// The projection expression.
- /// An optional partition key.
- Task ProjectOneAsync(Expression> filter, Expression> projection, string partitionKey = null)
- where TDocument : IDocument
- where TProjection : class;
-
- ///
- /// Asynchronously returns a projected document matching the filter condition.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type representing the model you want to project to.
- ///
- /// The projection expression.
- /// An optional partition key.
- Task ProjectOneAsync(Expression> filter, Expression> projection, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable
- where TProjection : class;
-
- ///
- /// Returns a projected document matching the filter condition.
- ///
- /// The type representing a Document.
- /// The type representing the model you want to project to.
- ///
- /// The projection expression.
- /// An optional partition key.
- TProjection ProjectOne(Expression> filter, Expression> projection, string partitionKey = null)
- where TDocument : IDocument
- where TProjection : class;
-
- ///
- /// Returns a projected document matching the filter condition.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type representing the model you want to project to.
- ///
- /// The projection expression.
- /// An optional partition key.
- TProjection ProjectOne(Expression> filter, Expression> projection, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable
- where TProjection : class;
-
- ///
- /// Asynchronously returns a list of projected documents matching the filter condition.
- ///
- /// The type representing a Document.
- /// The type representing the model you want to project to.
- ///
- /// The projection expression.
- /// An optional partition key.
- Task> ProjectManyAsync(Expression> filter, Expression> projection, string partitionKey = null)
- where TDocument : IDocument
- where TProjection : class;
-
- ///
- /// Asynchronously returns a list of projected documents matching the filter condition.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type representing the model you want to project to.
- ///
- /// The projection expression.
- /// An optional partition key.
- Task> ProjectManyAsync(Expression> filter, Expression> projection, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable
- where TProjection : class;
-
- ///
- /// Asynchronously returns a list of projected documents matching the filter condition.
- ///
- /// The type representing a Document.
- /// The type representing the model you want to project to.
- ///
- /// The projection expression.
- /// An optional partition key.
- List ProjectMany(Expression> filter, Expression> projection, string partitionKey = null)
- where TDocument : IDocument
- where TProjection : class;
-
- ///
- /// Asynchronously returns a list of projected documents matching the filter condition.
- ///
- /// The type representing a Document.
- /// The type of the primary key for a Document.
- /// The type representing the model you want to project to.
- ///
- /// The projection expression.
- /// An optional partition key.
- List ProjectMany(Expression> filter, Expression> projection, string partitionKey = null)
- where TDocument : IDocument
- where TKey : IEquatable
- where TProjection : class;
-
- #endregion
///
/// Asynchronously returns a paginated list of the documents matching the filter condition.
@@ -654,45 +62,6 @@ namespace MongoDbGenericRepository
Task GetAndUpdateOne(FilterDefinition filter, UpdateDefinition update, FindOneAndUpdateOptions options)
where TDocument : IDocument
where TKey : IEquatable;
-
- #region Grouping
-
- ///
- /// Groups a collection of documents given a grouping criteria,
- /// and returns a list of projected documents.
- ///
- /// The type representing a Document.
- /// The type of the grouping criteria.
- /// The type of the projected group.
- /// The grouping criteria.
- /// The projected group result.
- /// The partition key of your document, if any.
- List GroupBy(
- Expression> groupingCriteria,
- Expression, TProjection>> groupProjection,
- string partitionKey = null)
- where TDocument : IDocument
- where TProjection : class, new();
-
- ///
- /// Groups filtered a collection of documents given a grouping criteria,
- /// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
- ///
- /// The type representing a Document.
- /// The type of the grouping criteria.
- /// The type of the projected group.
- ///
- /// The grouping criteria.
- /// The projected group result.
- /// The partition key of your document, if any.
- List GroupBy(Expression> filter,
- Expression> selector,
- Expression, TProjection>> projection,
- string partitionKey = null)
- where TDocument : IDocument
- where TProjection : class, new();
-
- #endregion
}
}
diff --git a/MongoDbGenericRepository/Abstractions/IBaseReadOnlyRepository.cs b/MongoDbGenericRepository/Abstractions/IBaseReadOnlyRepository.cs
new file mode 100644
index 0000000..32d5c92
--- /dev/null
+++ b/MongoDbGenericRepository/Abstractions/IBaseReadOnlyRepository.cs
@@ -0,0 +1,410 @@
+using MongoDB.Driver;
+using MongoDbGenericRepository.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+
+namespace MongoDbGenericRepository
+{
+ public interface IBaseReadOnlyRepository
+ {
+ ///
+ /// The connection string.
+ ///
+ string ConnectionString { get; }
+
+ ///
+ /// The database name.
+ ///
+ string DatabaseName { get; }
+
+ #region Read TKey
+
+ ///
+ /// Asynchronously returns one document given its id.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// The Id of the document you want to get.
+ /// An optional partition key.
+ Task GetByIdAsync(TKey id, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ ///
+ /// Returns one document given its id.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// The Id of the document you want to get.
+ /// An optional partition key.
+ TDocument GetById(TKey id, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ ///
+ /// Asynchronously returns one document given an expression filter.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// A LINQ expression filter.
+ /// An optional partition key.
+ Task GetOneAsync(Expression> filter, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ ///
+ /// Returns one document given an expression filter.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// A LINQ expression filter.
+ /// An optional partition key.
+ TDocument GetOne(Expression> filter, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ ///
+ /// Returns a collection cursor.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// A LINQ expression filter.
+ /// An optional partition key.
+ IFindFluent GetCursor(Expression> filter, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+
+ ///
+ /// Returns true if any of the document of the collection matches the filter condition.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// A LINQ expression filter.
+ /// An optional partition key.
+ Task AnyAsync(Expression> filter, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ ///
+ /// Returns true if any of the document of the collection matches the filter condition.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// A LINQ expression filter.
+ /// An optional partition key.
+ bool Any(Expression> filter, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ ///
+ /// Asynchronously returns a list of the documents matching the filter condition.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// A LINQ expression filter.
+ /// An optional partition key.
+ Task> GetAllAsync(Expression> filter, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ ///
+ /// Returns a list of the documents matching the filter condition.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// A LINQ expression filter.
+ /// An optional partition key.
+ List GetAll(Expression> filter, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ ///
+ /// Asynchronously counts how many documents match the filter condition.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// A LINQ expression filter.
+ /// An optional partitionKey
+ Task CountAsync(Expression> filter, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ ///
+ /// Counts how many documents match the filter condition.
+ ///
+ /// The type representing a Document.
+ /// The type of the primary key for a Document.
+ /// A LINQ expression filter.
+ /// An optional partitionKey
+ long Count(Expression> filter, string partitionKey = null)
+ where TDocument : IDocument
+ where TKey : IEquatable;
+
+ #endregion
+
+ #region Min / Max
+
+ ///
+ /// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
+ ///
+ /// The document type.
+ /// The type of the primary key.
+ /// A LINQ expression filter.
+ /// A property selector to order by descending.
+ /// An optional partitionKey.
+ Task GetByMaxAsync(Expression> filter, Expression> orderByDescending, string partitionKey = null)
+ where TDocument : IDocument