minTimeuuid() and maxTimeuuid()

n1ql
#1

In Cassandra we have minTimeuuid() and maxTimeuuid() methods that aeturns a UUID -like result given a conditional time component as an argument. For example:

SELECT * FROM myTable
   WHERE t > maxTimeuuid('2013-01-01 00:05+0000')
   AND t < minTimeuuid('2013-02-02 10:00+0000')

See https://docs.datastax.com/en/dse/6.7/cql/cql/cql_using/refTimeUuidFunctions.html?hl=maxtimeuuidemphasized text

Is there similar methods in couchbase?

#2

Please reply , and tell me is it good idea to have uuidv1 as document key and use maxTimeuuid and minTimeuuid (I have implemented both in application side) to range query?

#3

If t follows ISO 8601 format https://docs.couchbase.com/server/6.0/n1ql/n1ql-language-reference/datefun.html you can use like this.

SELECT * FROM myTable
   WHERE t > '2013-01-01 00:05+0000'
   AND t < '2013-02-02 10:00+0000'
#4

@vsr1 I want to choose a unique key , so I want to have UUID V1 as key
The client side application get a list of docs and for pagination , I dont use offset and limite , instead client send last Id of doc as offset and in server side we do

SELECT * FROM myTable
   WHERE id > offset

sometimes we use maxTimeuuid(offset)

#5

use document key. Checkout https://blog.couchbase.com/offset-keyset-pagination-n1ql-query-couchbase/