3

Is there a way we can get a document's creation date in Couchbase (2.2.0).

We are currently not storing creation date in our documents, so wanted to know if couch stores that as part of document meta data.

We plan to query documents based on time, and currently the only option that we think will work is to change the server code to store additional creation date field as part of the document itself.

Gaurav
  • 33
  • 1
  • 4

2 Answers2

3

It is not tracked but if you have not modified the document since create you can use the CAS value (as of version 4.6), converted to a timestamp.

e.g. using N1QL: SELECT meta().cas/1000000000 ... -> gives seconds

2

Couchbase does not track the created date in the meta-data of an object. You would have to add this to your application to add to each document.

Kirk
  • 327
  • 1
  • 3
  • 10