-2

I want to fetch last X minutes record from the couch base using N1Ql ,

I know how to do this in SQL but in NOSQl with couch base i am not getting any clue . Please suggest me how i can do this.

Rohitesh
  • 1,514
  • 7
  • 28
  • 51

1 Answers1

3

I want to fetch last X minutes record from the couch base using N1Ql [...]

Do you mean all records added in the past X minutes? If so, according to this post Couchbase does not timestamp automatically: https://dba.stackexchange.com/questions/77108/couchbase-get-document-creation-date

It's best to add the timestamp yourself, and then it's just a simple task of reading all records with a timestamp in the last X minutes using a N1QL query. https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/datefun.html

Daniel E
  • 63
  • 6
  • basically i want to fetch last 5 minutes recorded from my document based on the creation time of it. I have 1 column creationTime and i want to use this column to fetch the information. – Rohitesh Jul 23 '19 at 06:39
  • If that is the case then this is really a simple question of "how do I query by date in N1QL", which has been answered elsewhere on this site. See https://stackoverflow.com/questions/47450503/couchbase-n1ql-query-data-between-two-days-without-time , for one example. – Daniel E Jul 23 '19 at 15:27