/** {@link RepositoryOperations#count} */ public long count(Iterable<QueryCriteria> queryCriterias) { Criteria criteria = MongoQueryUtils.getQueryFromQueryCriteria(queryCriterias); Query query = new Query(); if (criteria != null) { query.addCriteria(criteria); } return mongoOperations.count(query, model); }
/** {@link RepositoryOperations#findAll} */ public List<T> find(Iterable<QueryCriteria> queryCriterias, Sort sort) { Criteria criteria = MongoQueryUtils.getQueryFromQueryCriteria(queryCriterias); Query query = new Query(); if (criteria != null) { query.addCriteria(criteria); } return mongoOperations.find(query.with(sort), model); }
/** {@link RepositoryOperations#distinct(String, Iterable)} */ public List<Object> distinct(String field, Iterable<QueryCriteria> queryCriterias) { Criteria criteria = MongoQueryUtils.getQueryFromQueryCriteria(queryCriterias); Query query = new Query(); if (criteria != null) { query.addCriteria(criteria); } return mongoOperations .getCollection(mongoOperations.getCollectionName(model)) .distinct(field, query.getQueryObject()); }
/** {@link RepositoryOperations#findAll} */ public Page<T> find(Iterable<QueryCriteria> queryCriterias, Pageable pageable) { Criteria criteria = MongoQueryUtils.getQueryFromQueryCriteria(queryCriterias); Query query = new Query(); if (criteria != null) { query.addCriteria(criteria); } List<T> entities = mongoOperations.find(query.with(pageable), model); long count = count(queryCriterias); return new PageImpl<T>(entities, pageable, count); }