Timestamp comparison UTC format using ISO-8601 representation

Hi currently there is a task to compare 2 timestamps where my documents looks like
doc1{"timestamp ":“2019-12-12T06:41:44.718Z”}
doc2{"timestamp ":“2019-12-12T06:41:44.716Z”}
doc3{"timestamp ":“2019-12-12T06:41:44.714Z”}
doc4{"timestamp ":“2019-12-12T06:41:44.712Z”}

  1. CREATE INDEX ix_name ON test(timestamp);

  2. SELECT id FROM test AS d
    WHERE d.timestamp < “2019-12-12T06:41:44.718Z”;

This is resulting empty result, can you please suggest on this

1 Like

Couchbase dates are string comparable https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/datefun.html

 CREATE INDEX ix_name ON  `test` (timestamp);
SELECT META(d).id FROM test AS d
WHERE d.timestamp <  "2019-12-12T06:41:44.718Z";