USE LIMIT with USE KEYS

Hello,

How can i use LIMIT and OFFSET with USE KEYS clause ?

documentId: Account::1

     {
          "vodAccount": {
            "favorites": [
              {
                "flag": false,
                "creationDate": 3456,
                "groupId": "groupId::1"
              },
              {
                "flag": false,
                "creationDate": 6789,
                "groupId": "groupId::2"
              },     
            ]
        }
     }

I tried this query:

SELECT vodAccount.favorites f from default USE KEYS 'Account::1' ORDER BY f.creationDate LIMIT 1 OFFSET 0

LIMIT and OFFSET are applied at document returned in the projection.

When fetch one document, unless you use UNNEST, you’ll be returning (projecting) a single document.

When you have multiple keys, other predicates, grouping, etc., the number of documents can increase and LIMIT, OFFSET will be applied on the potential resultset.

SELECT *
FROM bucket USE KEYS [ ‘k1’, ‘k2’, ‘k3’, ‘k4’, ‘k5’]
ORDER BY a
OFFSET 2 LIMIT 1;

@a.u a quick note that if you just want to fetch subfields out of documents where you know the ID (and nothing else), then you can also use the subdocument API via KV from Couchbase Server 4.5.0 and later.

I used the sublist in java to realize the pagination. Thank you for your answers