什么是 Cloudant 文档过期字段?

What is cloudant document expiration field?

文档过期字段设置的是日期时间还是秒或毫秒? 据我所知是秒:

"expiration": 1543086426,

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

那为什么文档被 Cloudant 删除了? 如果是毫秒那么:

1543086426 =  Sunday 18 January 1970 12:38:06

这就解释了。那么如何为 cloudant 文档设置正确的到期值,例如从现在起 1 个月后?

另外,哪个 Cloudant 任务负责文档删除?它多久开始一次?

正如 CouchDB 文档中所指出的那样

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.

但是,Cloudant 不支持生存时间功能。

原因是 IBM Cloudant 文档只是 'soft' 删除,而不是删除。软删除涉及用较小的记录替换原始文档。此小记录或 'tombstone' 是复制目的所必需的;它有助于确保在复制期间可以识别要使用的正确修订。

如果 IBM Cloudant 中提供了 TTL 功能,短期文档和软删除记录的潜在增加将意味着数据库大小可能会无限增长。

有关详细信息,请参阅此 link on TTL