Sliced result using mongo template for the document(not nested)

旧时模样 提交于 2019-12-24 18:13:09

问题


How to retrieve Page result using mongo template

I have a scenario like below :

    final Pageable pageableRequest = PageRequest.of(offset, limit);
    Criteria criteria = where("");
    if (null != type) {
        criteria = criteria.and("type").is(type);
    }
    if (null != revision) {
        criteria = criteria.and("current_revision_data.data.revision_start").is(revision);
    }
    Query query = query(criteria).with(pageableRequest);
    Page<Invoice> invoices = mongoTemplate.find(query, Invoice.class);

Could someone point me how to get page of the result?

EDIT : To be more specific the last line that is : Page invoices = mongoTemplate.find(query, Invoice.class); is a compilation failure.

I would like to get Paged results which I could not find using MongoTemplate

Thanks

来源:https://stackoverflow.com/questions/49512846/sliced-result-using-mongo-template-for-the-documentnot-nested

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!