Filtering with sorting for the CountDoucmentAsync doesn't use indexes

Hi, would like to find documents with a total count of documents that meet the filter values restrictions. For the documents list my query uses an index and returns data in several milliseconds, but the problem is with the CountDocumentsAsync() which takes a few seconds. My collection has about million documents and is growing (about 100 000 each month)

This is part of my code

        var sortDefinition = new SortDefinitionBuilder<SnapshotDocument>().SortBy(query.SortingType ?? SortingType.Desc, SortBy(query.SortProperty));
        var filter = new FilterDefinitionBuilder<SnapshotDocument>()
            .And(IdFilterDefinition(query.Id),
                EntityIdFilterDefinition(query.EntityId),
                EntityTypeFilterDefinition(query.EntityType),
                OperationTypeFilterDefinition(query.OperationType),
                PerformedByFilterDefinition(query.PerformedBy),
                OperationDateFilterDefinition(query.OperationDateStart, query.OperationDateEnd));

        var auditLogsQuery = _dbContext.Snapshots
            .Find(filter)
            .Sort(sortDefinition);

        var auditLogsCount = await auditLogsQuery.CountDocumentsAsync(); //(1)

        var auditLogs = await auditLogsQuery.Project(...).Skip(...).Limit(...).ToListAsync() //(2)

I’ve observed, that (2) uses the proper index and makes an index scan, but (1) despite that I use sort definition, the counter doesn’t use the proper index. The count operation generates the following aggregation:

[
  {
    $group: {
      _id: 1,
      n: {
        $sum: 1,
      },
    },
  },
]

and it causes collscan.

For an empty ordering field, my code should generate the query with sorting by the operationDate, but there is no sorting in the generated query.

When I add sorting by creation date in the Mongo Compass, my plain Mongo query looks like the following:

[
  {
    $sort: {
      operationDate: -1,
    },
  },
  {
    $group: {
      _id: 1,
      n: {
        $sum: 1,
      },
    },
  },
]

and takes a few milliseconds, because uses COUNT_SCAN.

Any ideas on how to improve my c# code to use sorting in the CountDocumentsAsync?

Thanks