Sliced result using mongo template for the documen

2019-08-26 14:19发布

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

0条回答
登录 后发表回答