Would like to fetch latest record based on time stamp …
how could i achieve this using n1ql.
my table is like this
apple 12/13/2015
apple 12/13/2016
want to pull latest from my couchdb.
how to do that.
Would like to fetch latest record based on time stamp …
how could i achieve this using n1ql.
my table is like this
apple 12/13/2015
apple 12/13/2016
want to pull latest from my couchdb.
how to do that.
Store timestamp asISO-8601 FORMAT example “2018-04-05T15:50:40.536-07:00”
CREATE INDEX ix1 ON default(timestamp DESC);
INSERT INTO default VALUES("k01",{"timestamp":"2018-04-05T15:50:40.536-07:00"});
INSERT INTO default VALUES("k01",{"timestamp":"2018-02-05T15:50:40.536-07:00"});
INSERT INTO default VALUES("k01",{"timestamp":"2018-01-05T15:50:40.536-07:00"});
SELECT * FROM default WHERE timestamp IS NOT NULL ORDER BY timestamp DESC LIMIT 1;
Thank you it helps a lot