本文整理了Java中org.springframework.data.mongodb.core.MongoTemplate.count()
方法的一些代码示例,展示了MongoTemplate.count()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongoTemplate.count()
方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.MongoTemplate
类名称:MongoTemplate
方法名:count
暂无
代码示例来源:origin: stackoverflow.com
@Repository
public class PersonRepository {
@Autowired
MongoTemplate mongoTemplate;
public long countAllPersons() {
return mongoTemplate.count(null, Person.class);
}
}
代码示例来源:origin: spring-projects/spring-data-mongodb
@Override
public long count(final Query query, String collectionName) {
return count(query, null, collectionName);
}
代码示例来源:origin: spring-projects/spring-data-mongodb
@Override
public long count(Query query, Class<?> entityClass) {
Assert.notNull(entityClass, "Entity class must not be null!");
return count(query, entityClass, operations.determineCollectionName(entityClass));
}
代码示例来源:origin: spring-projects/spring-data-mongodb
@Override
public long count() {
return template.count(query, domainType, getCollectionName());
}
代码示例来源:origin: kaaproject/kaa
protected long count(Query query) {
return mongoTemplate.count(query, getDocumentClass());
}
代码示例来源:origin: org.springframework.data/spring-data-mongodb
@Override
public long count(final Query query, String collectionName) {
return count(query, null, collectionName);
}
代码示例来源:origin: yu199195/myth
baseQuery.addCriteria(new Criteria("transId").is(query.getTransId()));
final long totalCount = mongoTemplate.count(baseQuery, mongoTableName);
if (totalCount <= 0) {
return voCommonPager;
代码示例来源:origin: yu199195/hmily
baseQuery.addCriteria(new Criteria("retriedCount").lt(query.getRetry()));
final long totalCount = mongoTemplate.count(baseQuery, mongoTableName);
if (totalCount <= 0) {
return voCommonPager;
代码示例来源:origin: yu199195/Raincat
baseQuery.addCriteria(new Criteria("retriedCount").lt(query.getRetry()));
final long totalCount = mongoTemplate.count(baseQuery, mongoTableName);
if (totalCount <= 0) {
return voCommonPager;
代码示例来源:origin: spring-projects/spring-integration
@Override
public int messageGroupSize(Object groupId) {
long lCount = this.mongoTemplate.count(groupIdQuery(groupId), this.collectionName);
Assert.isTrue(lCount <= Integer.MAX_VALUE, "Message count is out of Integer's range");
return (int) lCount;
}
代码示例来源:origin: org.springframework.data/spring-data-mongodb
@Override
public long count(Query query, Class<?> entityClass) {
Assert.notNull(entityClass, "Entity class must not be null!");
return count(query, entityClass, operations.determineCollectionName(entityClass));
}
代码示例来源:origin: org.springframework.data/spring-data-mongodb
@Override
public long count() {
return template.count(query, domainType, getCollectionName());
}
代码示例来源:origin: spring-projects/spring-integration
@Override
public int messageGroupSize(Object groupId) {
long lCount = this.template.count(new Query(Criteria.where(GROUP_ID_KEY).is(groupId)), this.collectionName);
Assert.isTrue(lCount <= Integer.MAX_VALUE, "Message count is out of Integer's range");
return (int) lCount;
}
代码示例来源:origin: timebusker/spring-boot
@Override
public List<PersonEntity> findWithPageByParams(Map params) {
Query query = new Query();
MongoDBPageable pageable = new MongoDBPageable(2);
Iterator<String> iterator = params.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next();
query.addCriteria(Criteria.where(key).lt(params.get(key)));
}
Long allcount = mongoTemplate.count(query, PersonEntity.class);
List<PersonEntity> list = mongoTemplate.find(query.with(pageable), PersonEntity.class);
Page<PersonEntity> page = new PageImpl<PersonEntity>(list, pageable, allcount);
return page.getContent();
}
}
代码示例来源:origin: spring-projects/spring-integration
@Override
@ManagedAttribute
public int getMessageCountForAllMessageGroups() {
Query query = Query.query(Criteria.where(MessageDocumentFields.MESSAGE_ID).exists(true)
.and(MessageDocumentFields.GROUP_ID).exists(true));
long count = this.mongoTemplate.count(query, this.collectionName);
Assert.isTrue(count <= Integer.MAX_VALUE, "Message count is out of Integer's range");
return (int) count;
}
代码示例来源:origin: spring-projects/spring-integration
@Override
@ManagedAttribute
public int getMessageCountForAllMessageGroups() {
Query query = Query.query(Criteria.where(MessageDocumentFields.MESSAGE_ID).exists(true)
.and(MessageDocumentFields.GROUP_ID).exists(true));
long count = this.template.count(query, this.collectionName);
Assert.isTrue(count <= Integer.MAX_VALUE, "Message count is out of Integer's range");
return (int) count;
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl
@Override
public Long countCriteria(CriteriaQuery query) {
Query mongoQuery = buildQuery(query);
return mongoTemplate.count(mongoQuery, ObservationCriterion.class);
}
代码示例来源:origin: com.sangupta/jerry-services
/**
* Count the total number of objects in the collection
*
* @return the total number of objects
*/
@Override
public long count() {
long items = this.mongoTemplate.count(new Query(), this.entityClass);
return items;
}
代码示例来源:origin: org.springframework.integration/spring-integration-mongodb
@Override
public int messageGroupSize(Object groupId) {
long lCount = this.mongoTemplate.count(groupIdQuery(groupId), this.collectionName);
Assert.isTrue(lCount <= Integer.MAX_VALUE, "Message count is out of Integer's range");
return (int) lCount;
}
代码示例来源:origin: com.epam.reportportal/commons-dao
@Override
public boolean hasLogs(Iterable<TestItem> items) {
Query query = query(where(ITEM_REFERENCE).in(DbUtils.toIds(items)));
return mongoTemplate.count(query, Log.class) > 0;
}
内容来源于网络,如有侵权,请联系作者删除!