public List<Document> export(final String collectionName,
                                 final List<String> exportedFieldNames,
                                 final int limit,
                                 final Bson dbFilter,
                                 final List<Sort> sorts,
                                 final Subject subject) {
        final MongoCollection<Document> collection = mongoConnection.getMongoDatabase().getCollection(collectionName);
        final FindIterable<Document> resultsWithoutLimit = collection.find(Objects.requireNonNullElse(dbFilter, Filters.empty()))
                .projection(Projections.fields(Projections.include(exportedFieldNames)))
                .sort(toMongoDbSort(sorts));

        final var userCanReadAllEntities = permissionsUtils.hasAllPermission(subject) || permissionsUtils.hasReadPermissionForWholeCollection(subject, collectionName);
        final var checkPermission = permissionsUtils.createPermissionCheck(subject, collectionName);
        final var documents = userCanReadAllEntities
                ? getFromMongo(resultsWithoutLimit, limit)
                : getWithInMemoryPermissionCheck(resultsWithoutLimit, limit, checkPermission);

        return documents.collect(Collectors.toList());

    }
@Test
    void testExportUsesFilterCorrectly() {
        insertTestData();
        simulateAdminUser();
        final List<Document> exportedDocuments = toTest.export(TEST_COLLECTION_NAME,
                List.of("name"),
                200,
                Filters.gt("age", 40),
                List.of(),
                subject);

        assertThat(exportedDocuments)
                .isNotNull()
                .hasSize(1)
                .containsExactly(
                        new Document(Map.of("_id", "0000000000000000000000a5", "name", "John"))
                );
    }