Search in sources :

Example 81 with Query

use of org.springframework.data.mongodb.core.query.Query in project cas by apereo.

the class U2FMongoDbDeviceRepository method removeAll.

@Override
public void removeAll() {
    val query = new Query();
    query.addCriteria(Criteria.where("createdDate").exists(true));
    mongoTemplate.remove(query, U2FDeviceRegistration.class, casProperties.getAuthn().getMfa().getU2f().getMongo().getCollection());
}
Also used : lombok.val(lombok.val) Query(org.springframework.data.mongodb.core.query.Query)

Example 82 with Query

use of org.springframework.data.mongodb.core.query.Query in project cas by apereo.

the class MongoDbYubiKeyAccountRegistry method delete.

@Override
public void delete(final String uid) {
    val query = new Query();
    query.addCriteria(Criteria.where(MongoDbYubiKeyAccount.FIELD_USERNAME).is(uid));
    this.mongoTemplate.remove(query, MongoDbYubiKeyAccount.class, this.collectionName);
}
Also used : lombok.val(lombok.val) Query(org.springframework.data.mongodb.core.query.Query)

Example 83 with Query

use of org.springframework.data.mongodb.core.query.Query in project cas by apereo.

the class MongoDbCasEventRepository method load.

@Override
public Stream<? extends CasEvent> load(final ZonedDateTime dateTime) {
    val query = new Query();
    query.addCriteria(Criteria.where(CREATION_TIME_PARAM).gte(dateTime.toString()));
    return this.mongoTemplate.stream(query, CasEvent.class, this.collectionName).stream();
}
Also used : lombok.val(lombok.val) Query(org.springframework.data.mongodb.core.query.Query) CasEvent(org.apereo.cas.support.events.dao.CasEvent)

Example 84 with Query

use of org.springframework.data.mongodb.core.query.Query in project cas by apereo.

the class MongoDbCasEventRepository method getEventsOfTypeForPrincipal.

@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).stream();
}
Also used : lombok.val(lombok.val) Query(org.springframework.data.mongodb.core.query.Query) CasEvent(org.apereo.cas.support.events.dao.CasEvent)

Example 85 with Query

use of org.springframework.data.mongodb.core.query.Query in project cas by apereo.

the class MongoDbCasEventRepository method getEventsOfTypeForPrincipal.

@Override
public Stream<? extends CasEvent> getEventsOfTypeForPrincipal(final String type, final String principal, final ZonedDateTime dateTime) {
    val query = new Query();
    query.addCriteria(Criteria.where(TYPE_PARAM).is(type).and(PRINCIPAL_ID_PARAM).is(principal).and(CREATION_TIME_PARAM).gte(dateTime.toString()));
    return this.mongoTemplate.stream(query, CasEvent.class, this.collectionName).stream();
}
Also used : lombok.val(lombok.val) Query(org.springframework.data.mongodb.core.query.Query) CasEvent(org.apereo.cas.support.events.dao.CasEvent)

Aggregations

Query (org.springframework.data.mongodb.core.query.Query)690 Test (org.junit.jupiter.api.Test)391 BasicQuery (org.springframework.data.mongodb.core.query.BasicQuery)259 NearQuery (org.springframework.data.mongodb.core.query.NearQuery)109 TextQuery (org.springframework.data.mongodb.core.query.TextQuery)91 Document (org.bson.Document)90 Update (org.springframework.data.mongodb.core.query.Update)83 Criteria (org.springframework.data.mongodb.core.query.Criteria)74 Test (org.junit.Test)72 lombok.val (lombok.val)50 ObjectId (org.bson.types.ObjectId)47 PartTree (org.springframework.data.repository.query.parser.PartTree)44 Sort (org.springframework.data.domain.Sort)41 StepVerifier (reactor.test.StepVerifier)39 Assertions (org.assertj.core.api.Assertions)30 Bson (org.bson.conversions.Bson)29 Mono (reactor.core.publisher.Mono)29 Point (org.springframework.data.geo.Point)28 Collation (org.springframework.data.mongodb.core.query.Collation)27 List (java.util.List)26