use of org.jongo.Find in project profile by craftercms.
the class ProfileRepositoryImpl method findRange.
@Override
public Iterable<Profile> findRange(String tenantName, String sortBy, SortOrder sortOrder, Integer start, Integer count, String... attributesToReturn) throws MongoDataException {
try {
String query = getQueryFor(KEY_FIND_BY_TENANT_QUERY);
Find find = getCollection().find(query, tenantName);
addSort(find, sortBy, sortOrder);
addRange(find, start, count);
addProjection(find, attributesToReturn);
return find.as(Profile.class);
} catch (MongoException ex) {
String msg = "Unable to find range of profiles for tenant '" + tenantName + "'";
logger.error(msg, ex);
throw new MongoDataException(msg, ex);
}
}
Aggregations