Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is cloudant document expiration field?

Is document expiration field set with date-time or seconds or milliseconds? As I know it's seconds:

"expiration": 1543086426,

So 1543086426 = Saturday, November 24, 2018 7:07:06 PM

Then why the document is being removed by Cloudant? If it's milliseconds then:

1543086426 =  Sunday 18 January 1970 12:38:06

that explains. So how do I set proper expiration value for cloudant document e.g. in 1 month from now?

Also, which Cloudant task is responsible for document removal? And how often it starts?

like image 966
John Glabb Avatar asked Oct 25 '18 19:10

John Glabb


People also ask

Which field is used to identify Cloudant?

The partitioned field This field determines whether the created index is a partitioned or global index.

What is a document in Cloudant?

Documents are JSON objects. Documents are also containers for your data, and are the basis of the IBM® Cloudant® for IBM Cloud® database. If you're using an IBM Cloudant service on IBM Cloud®, documents are limited to a maximum size of 1 MB.

Why must the Rev field be specified when updating documents on the Cloudant service?

You must specify the previous _rev when you update a document or else your request fails and returns a 409 error. _rev must not be used to build a version control system because it is an internal value that is used by the server. Therefore, older revisions of a document are transient, and removed regularly.

Which two fields are required for any document in a Cloudant database?

All documents have the following unique mandatory fields, Unique _id and _rev. In addition to these two mandatory fields, documents can contain any other content that is expressed in the JSON format.


1 Answers

As pointed out in the CouchDB document

Time to live (TTL) is the amount of time until a document expires in Couchbase Server. By default, all documents have a TTL of zero, which indicates the document is kept indefinitely. Typically when you add, set, or replace information, you establish a custom TTL by passing it as a parameter to your method call. As part of normal maintenance operations, Couchbase Server periodically removes all items with expiration times that have passed.

Depending on the amount of time you want to specify for the document to live, you provide a TTL value as a relative number of seconds into the future or in Unix time . Unix time represents a specific date and time expressed as the number of seconds that have elapsed since Thursday, 1 January 1970 at 00:00:00 Coordinated Universal Time (UTC) . For example, the value 1421454149 represents Saturday, 17 January 2015 at 00:22:29 UTC.

But, Cloudant does not support Time to Live functions.

The reason is that IBM Cloudant documents are only 'soft' deleted, not deleted. The soft deletion involves replacing the original document with a smaller record. This small record or 'tombstone' is required for replication purposes; it helps ensure that the correct revision to use can be identified during replication.

If the TTL capability was available in IBM Cloudant, the resulting potential increase in short-lived documents and soft deletion records would mean that the database size might grow in an unbounded fashion.

For more info, refer this link on TTL

like image 166
Vidyasagar Machupalli Avatar answered Oct 08 '22 21:10

Vidyasagar Machupalli