Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration of document expiry #301

Closed
OldSneerJaw opened this issue Apr 15, 2018 · 1 comment
Closed

Configuration of document expiry #301

OldSneerJaw opened this issue Apr 15, 2018 · 1 comment
Assignees
Labels
enhancement New/updated feature

Comments

@OldSneerJaw
Copy link
Owner

OldSneerJaw commented Apr 15, 2018

Feature Request

Description

Sync Gateway 2.0 introduced a new function to the sync function API: expiry. This function sets either the absolute date/time at which the document will expire or the relative number of seconds until it expires. Provide a declarative configuration option to specify when documents of a specific type should expire.

See Expiration Overview for more information on how document expiration behaves in Couchbase Server.

Examples

Specified as an absolute ISO 8601 date string:

{
  type: ...,
  channels: ...,
  propertyValidators: ...,
  expiry: '2022-12-31T23:59:59Z'
}

Specified as an absolute Unix time (i.e. number of seconds since 1970-01-01 at midnight UTC):

{
  type: ...,
  channels: ...,
  propertyValidators: ...,
  expiry: 1672531199
}

Specified as the relative number of seconds after the most recent add or replace operation (e.g. 14 days):

{
  type: ...,
  channels: ...,
  propertyValidators: ...,
  expiry: 1209600
}

Specified as an absolute JavaScript Date object:

{
  type: ...,
  channels: ...,
  propertyValidators: ...,
  expiry: new Date(Date.UTC(2019, 11, 31, 23, 59, 59, 999))
}
@OldSneerJaw OldSneerJaw added the enhancement New/updated feature label Apr 15, 2018
@OldSneerJaw OldSneerJaw self-assigned this Apr 15, 2018
@OldSneerJaw OldSneerJaw changed the title Configuration for documente expiry Configuration for document expiry Apr 15, 2018
@OldSneerJaw OldSneerJaw changed the title Configuration for document expiry Configuration of document expiry Apr 16, 2018
OldSneerJaw added a commit that referenced this issue Apr 21, 2018
A document definition may now specify when documents of that type will expire, either as an absolute Unix timestamp, ISO 8601 date string, Date object or as a relative time offset in seconds. Includes a new custom action that occurs immediately after document expiry is set: `onExpiryAssignmentSucceeded`.
OldSneerJaw added a commit that referenced this issue Apr 21, 2018
The date string format for the Sync Gateway `expiry` function does not consider any element optional. The document definition schema validator now respects the expected format.
OldSneerJaw added a commit that referenced this issue Apr 22, 2018
OldSneerJaw added a commit that referenced this issue Apr 22, 2018
The bug in question was first reported as issue [#3452](couchbase/sync_gateway#3452). The duplicate issue ([#3489](couchbase/sync_gateway#3489)) has since been closed.
@dkichler
Copy link
Collaborator

Addressed by #304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New/updated feature
Projects
None yet
Development

No branches or pull requests

2 participants