@Override
    public Stream<? extends CasEvent> getEventsOfTypeForPrincipal(final String type, final String principal) {
        val query = new Query();
        query.addCriteria(Criteria.where(TYPE_PARAM).is(type).and(PRINCIPAL_ID_PARAM).is(principal));
        return this.mongoTemplate.stream(query, CasEvent.class, this.collectionName);
    }
This is {@link MongoDbCasEventRepository} that stores event data into a mongodb database.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-events-mongo/src/main/java/org/apereo/cas/support/events/mongo/MongoDbCasEventRepository.java