class UnitComputedInheritedRulesInvalidationRepository extends ReportCommonRepository {

    public CloseableIterator<Document> findCollectionByProcessIdTenant(String processId, int tenantId) {

        MongoCursor<Document> cursor = collection.aggregate(
            Arrays.asList(
                Aggregates.match(and(
                    eq(UnitComputedInheritedRulesInvalidationModel.PROCESS_ID, processId),
                    eq(UnitComputedInheritedRulesInvalidationModel.TENANT, tenantId)
                )),
                Aggregates.project(Projections.fields(
                    new Document("_id", 0),
                    new Document("id", "$_metadata.id")
                    )
                ))
        )
            // Aggregation query requires more than 100MB to proceed.
            .allowDiskUse(true)
            .iterator();

        return new CloseableIterator<Document>() {

            @Override
            public void close() {
                cursor.close();
            }

            @Override
            public boolean hasNext() {
                return cursor.hasNext();
            }

            @Override
            public Document next() {
                return cursor.next();
            }
        };
    }

    @VisibleForTesting  UnitComputedInheritedRulesInvalidationRepository(MongoDbAccess mongoDbAccess, String collectionName);
    public  UnitComputedInheritedRulesInvalidationRepository(SimpleMongoDBAccess mongoDbAccess);

}