Hi Matt,

I am using Couchbase 4.0.0-4047 Community Edition (build-4047). Yes, new 
Spring Data milestone has N1QL support, but I guess they still don't 
support offset. This issue is related couchbase java client or couchbase. 
Is there any other way to implement pagination?

On Monday, 28 September 2015 10:12:15 UTC-7, Matt Ingenthron wrote:
>
> Which version of Couchbase 4.0 are you using?  RC0?
>
> Note that the new Spring Data milestone has N1QL support and it'll track 
> that through release.
>
> Matt
>
> On Sun, Sep 27, 2015 at 11:33 PM, Pritish Shah <[email protected] 
> <javascript:>> wrote:
>
>> I have started using couchbase recently. I am using Spring-Data couchbase 
>> for inserting Java POJOs in Couchbase. Since, Pagination and Sorting is not 
>> supported by Spring Data Couchbase project, I have tried to use couchbase 
>> java client 2.2.0-dp2.
>>
>> I have inserted 8 users where ids ranging from 1 to 8.
>>
>> I have wrote following code to apply pagination and sorting. 
>>
>>     public void test() {
>>             int offset = 5 * (1 - 1);
>>             Statement statement = 
>> select("*").from("test").where(x("_class").eq(s("com.test.rest.entity.User"))).orderBy(Sort.asc("id")).limit(5).offset(offset);
>>             log.info(statement.toString());
>>             Iterator<QueryRow> result = 
>> bucket.query(Query.simple(statement)).rows();
>>     
>>             while(result.hasNext()) {
>>                 QueryRow doc = result.next();
>>                 log.info("Document:: " + doc.value());
>>             }
>>     }
>>
>> However, I am seeing result as below. It should be test1 to test5, though 
>> users being selected randomly. Can someone help me with that?
>>
>>     Document:: 
>> {“test":{"createdAt":1.443420400374E12,"firstname":"test5","_class":"com.test.rest.entity.User","type":"User","lastname":"test5"}}
>>  
>>     Document:: 
>> {“test":{"createdAt":1.443420708495E12,"firstname":"test8","_class":"com.test.rest.entity.User","type":"User","lastname":"test8"}}
>>  
>>     Document:: 
>> {“test:{"createdAt":1.443420386638E12,"firstname":"test2","_class":"com.test.rest.entity.User","type":"User","lastname":"test2"}}
>>  
>>     Document:: 
>> {“test":{"createdAt":1.443420704104E12,"firstname":"test7","_class":"com.test.rest.entity.User","type":"User","lastname":"test7"}}
>>  
>>     Document:: 
>> {“test":{"createdAt":1.443420379712E12,"firstname":"test1","_class":"com.test.rest.entity.User","type":"User","lastname":"test1"}}
>>  
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Couchbase" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to