本文整理了Java中org.springframework.data.mongodb.core.query.Query.query
方法的一些代码示例,展示了Query.query
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.query
方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.query.Query
类名称:Query
方法名:query
[英]Static factory method to create a Query using the provided CriteriaDefinition.
[中]使用提供的标准定义创建查询的静态工厂方法。
代码示例来源:origin: kaaproject/kaa
@Override
public Optional<MongoEndpointRegistration> findByEndpointId(String endpointId) {
LOG.debug("Searching for endpoint registration by endpoint ID [{}]", endpointId);
Query query = Query.query(
Criteria.where(MongoModelConstants.EP_REGISTRATION_ENDPOINT_ID)
.is(endpointId));
return Optional.ofNullable(this.findOne(query));
}
代码示例来源:origin: kaaproject/kaa
@Override
public Optional<MongoEndpointRegistration> findByCredentialsId(String credentialsId) {
LOG.debug("Searching for endpoint registration by credentials ID [{}]", credentialsId);
Query query = Query.query(
Criteria.where(MongoModelConstants.EP_REGISTRATION_CREDENTIALS_ID)
.is(credentialsId));
return Optional.ofNullable(this.findOne(query));
}
代码示例来源:origin: kaaproject/kaa
@Override
public void removeNotificationsByAppId(final String appId) {
LOG.debug("Remove unicast notifications by application id [{}] ", appId);
remove(query(where(EP_NF_APPLICATION_ID).is(appId)));
}
代码示例来源:origin: kaaproject/kaa
@Override
public List<MongoEndpointProfile> findByEndpointUserId(String endpointUserId) {
LOG.debug("Find endpoint profiles by endpoint user id [{}] ", endpointUserId);
return find(query(where(EP_USER_ID).is(endpointUserId)));
}
代码示例来源:origin: kaaproject/kaa
@Override
public void removeByEndpointId(String endpointId) {
LOG.debug("Removing endpoint registration by endpoint ID [{}]", endpointId);
Query query = Query.query(
Criteria.where(MongoModelConstants.EP_REGISTRATION_ENDPOINT_ID)
.is(endpointId));
this.remove(query);
}
}
代码示例来源:origin: kaaproject/kaa
@Override
public void removeByHash(byte[] hash) {
LOG.debug("Remove topic list entry by hash [{}] ", hash);
remove(query(where(ID).is(hash)));
}
}
代码示例来源:origin: kaaproject/kaa
@Override
public void removeByAppId(String appId) {
LOG.debug("Remove endpoint profile by application id [{}] ", appId);
remove(query(where(EP_APPLICATION_ID).is(appId)));
}
代码示例来源:origin: kaaproject/kaa
@Override
public void removeNotificationsByKeyHash(final byte[] keyHash) {
LOG.debug("Remove unicast notifications by endpoint key hash [{}] ", keyHash);
mongoTemplate.remove(query(where(EP_ENDPOINT_KEY_HASH).is(keyHash)), getCollectionName());
}
代码示例来源:origin: kaaproject/kaa
@Override
public Optional<MongoCredentials> find(String applicationId, String credentialsId) {
LOG.debug("Searching for credentials by application ID [{}] and credentials ID [{}]",
applicationId, credentialsId);
Query query = Query.query(Criteria.where(MongoModelConstants.CREDENTIALS_ID)
.is(credentialsId)
.and(MongoModelConstants.APPLICATION_ID)
.is(applicationId));
return Optional.ofNullable(this.findOne(query));
}
代码示例来源:origin: kaaproject/kaa
@Override
public void removeByExternalIdAndTenantId(String externalId, String tenantId) {
LOG.debug("Remove user by external uid [{}] and tenant id [{}] ", externalId, tenantId);
remove(query(where(EP_USER_EXTERNAL_ID)
.is(externalId)
.and(EP_USER_TENANT_ID)
.is(tenantId)));
}
代码示例来源:origin: kaaproject/kaa
@Override
public MongoEndpointProfile findEndpointIdByKeyHash(byte[] endpointKeyHash) {
LOG.debug("Get count of endpoint profiles by endpoint key hash [{}] ", endpointKeyHash);
Query query = query(where(EP_ENDPOINT_KEY_HASH).is(endpointKeyHash));
query.fields().include(ID);
return findOne(query);
}
代码示例来源:origin: kaaproject/kaa
@Override
public MongoEndpointUser findByExternalIdAndTenantId(String externalId, String tenantId) {
LOG.debug("Find user by external uid [{}] and tenant id [{}] ", externalId, tenantId);
return findOne(query(where(EP_USER_EXTERNAL_ID)
.is(externalId).and(EP_USER_TENANT_ID)
.is(tenantId)));
}
代码示例来源:origin: kaaproject/kaa
@Override
public void removeByEndpointKeyHashAndConfigurationVersion(byte[] endpointKeyHash, Integer confSchemaVersion) {
LOG.debug("Remove endpoint specific configuration by endpoint key hash [{}] ", endpointKeyHash);
mongoTemplate.remove(
query(where(EP_SPECIFIC_CONFIGURATION_KEY_HASH).is(endpointKeyHash)
.and(EP_CONFIGURATION_VERSION).is(confSchemaVersion)), getCollectionName());
}
代码示例来源:origin: kaaproject/kaa
@Override
public List<MongoEndpointNotification> findNotificationsByKeyHash(final byte[] keyHash) {
LOG.debug("Find unicast notifications by endpoint key hash [{}] ", keyHash);
DBObject dbObject = query(where(EP_ENDPOINT_KEY_HASH).is(keyHash)).getQueryObject();
DBCursor cursor = mongoTemplate.getDb().getCollection(getCollectionName()).find(dbObject);
List<MongoEndpointNotification> endpointNotifications = new ArrayList<>();
while (cursor.hasNext()) {
endpointNotifications.add(mongoTemplate.getConverter()
.read(MongoEndpointNotification.class, cursor.next()));
}
return endpointNotifications;
}
代码示例来源:origin: spring-projects/spring-data-examples
private Mono<Process> finish(ReactiveMongoOperations operations, Process process) {
return operations.update(Process.class).matching(Query.query(Criteria.where("id").is(process.getId())))
.apply(Update.update("state", State.DONE).inc("transitionCount", 1)).first() //
.then(Mono.just(process));
}
代码示例来源:origin: spring-projects/spring-data-examples
Mono<Process> start(ReactiveMongoOperations operations, Process process) {
return operations.update(Process.class).matching(Query.query(Criteria.where("id").is(process.getId())))
.apply(Update.update("state", State.ACTIVE).inc("transitionCount", 1)).first() //
.then(Mono.just(process));
}
代码示例来源:origin: kaaproject/kaa
@Override
public MongoEndpointProfile findByKeyHash(byte[] endpointKeyHash) {
LOG.debug("Find endpoint profile by endpoint key hash [{}] ", endpointKeyHash);
DBObject dbObject = query(where(EP_ENDPOINT_KEY_HASH)
.is(endpointKeyHash))
.getQueryObject();
DBObject result = mongoTemplate.getDb()
.getCollection(getCollectionName())
.findOne(dbObject);
return mongoTemplate.getConverter().read(getDocumentClass(), result);
}
代码示例来源:origin: kaaproject/kaa
@Override
public MongoTopicListEntry findByHash(byte[] hash) {
LOG.debug("Find topic list entry by hash [{}] ", hash);
DBObject dbObject = query(where(ID).is(hash)).getQueryObject();
DBObject result = mongoTemplate.getDb()
.getCollection(getCollectionName())
.findOne(dbObject);
return mongoTemplate.getConverter().read(getDocumentClass(), result);
}
代码示例来源:origin: spring-projects/spring-data-examples
private void finish(Process process) {
template.update(Process.class).matching(Query.query(Criteria.where("id").is(process.getId())))
.apply(Update.update("state", State.DONE).inc("transitionCount", 1)).first();
}
代码示例来源:origin: spring-projects/spring-data-examples
void start(Process process) {
template.update(Process.class).matching(Query.query(Criteria.where("id").is(process.getId())))
.apply(Update.update("state", State.ACTIVE).inc("transitionCount", 1)).first();
}
内容来源于网络,如有侵权,请联系作者删除!