@Override
    public Stream<Ticket> stream(final TicketRegistryStreamCriteria criteria) {
        return ticketCatalog
            .findAll()
            .stream()
            .map(this::getTicketCollectionInstanceByMetadata)
            .flatMap(map -> mongoTemplate.stream(new Query(), MongoDbTicketDocument.class, map))
            .skip(criteria.getFrom())
            .limit(criteria.getCount())
            .map(ticket -> decodeTicket(deserializeTicket(ticket.getJson(), ticket.getType())));
    }
Calculate the time at which the ticket is eligible for automated deletion by MongoDb.
Makes the assumption that the CAS server date and the Mongo server date are in sync.
support/cas-server-support-mongo-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/MongoDbTicketRegistry.java