{"action":"created","issue":{"url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1881","repository_url":"https://api.github.com/repos/couchbase/sync_gateway","labels_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1881/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1881/comments","events_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1881/events","html_url":"https://github.com/couchbase/sync_gateway/pull/1881","id":160957839,"number":1881,"title":"Expiry support for SG documents","user":{"login":"adamcfraser","id":8866453,"avatar_url":"https://avatars.githubusercontent.com/u/8866453?v=3","gravatar_id":"","url":"https://api.github.com/users/adamcfraser","html_url":"https://github.com/adamcfraser","followers_url":"https://api.github.com/users/adamcfraser/followers","following_url":"https://api.github.com/users/adamcfraser/following{/other_user}","gists_url":"https://api.github.com/users/adamcfraser/gists{/gist_id}","starred_url":"https://api.github.com/users/adamcfraser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamcfraser/subscriptions","organizations_url":"https://api.github.com/users/adamcfraser/orgs","repos_url":"https://api.github.com/users/adamcfraser/repos","events_url":"https://api.github.com/users/adamcfraser/events{/privacy}","received_events_url":"https://api.github.com/users/adamcfraser/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/couchbase/sync_gateway/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"ajres","id":7745210,"avatar_url":"https://avatars.githubusercontent.com/u/7745210?v=3","gravatar_id":"","url":"https://api.github.com/users/ajres","html_url":"https://github.com/ajres","followers_url":"https://api.github.com/users/ajres/followers","following_url":"https://api.github.com/users/ajres/following{/other_user}","gists_url":"https://api.github.com/users/ajres/gists{/gist_id}","starred_url":"https://api.github.com/users/ajres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajres/subscriptions","organizations_url":"https://api.github.com/users/ajres/orgs","repos_url":"https://api.github.com/users/ajres/repos","events_url":"https://api.github.com/users/ajres/events{/privacy}","received_events_url":"https://api.github.com/users/ajres/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2016-06-17T19:22:34Z","updated_at":"2016-06-20T23:26:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/couchbase/sync_gateway/pulls/1881","html_url":"https://github.com/couchbase/sync_gateway/pull/1881","diff_url":"https://github.com/couchbase/sync_gateway/pull/1881.diff","patch_url":"https://github.com/couchbase/sync_gateway/pull/1881.patch"},"body":"When writing a document to Sync Gateway (via PUT doc or bulk_docs), users can set the '_exp' property in the body of the document.  When Sync Gateway writes the document, it will:\r\n - Set a Couchbase Server expiry on the document, based on the exp value (see below for format)\r\n - Strip the _exp property from the document body (to avoid compatibility issues around the leading underscore when that document is replicated elsewhere)\r\n - Set an expiry property - `exp` - in the document's sync metadata, to provide some visibility on the expiry value\r\n\r\nWhen Sync Gateway reads a document (via document GET, bulk_get), it will recreate the _exp property in the body as an ISO-8601 only if the query string includes show_exp=true .\r\n\r\nSupported formats for the incoming _exp value:\r\n - JSON number.  Will be treated as a Couchbase Server expiry value (ttl in second when less than 30 days, unix time when greater)\r\n - JSON string (numeric format) - same as JSON number\r\n - JSON string (as ISO-8601 date).  Converted to Couchbase server expiry value.\r\n - JSON null.  Sets expiry to zero (no expiry)\r\n\r\nNote that subsequent updates to the document will use the expiry value on the update.  If no expiry value is set on a new revision of a document that was previously set to expire, the new version of the document will have no expiry set.\r\n\r\nFixes #1823\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"35\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/couchbase/sync_gateway/1881)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/couchbase/sync_gateway/issues/comments/227299512","html_url":"https://github.com/couchbase/sync_gateway/pull/1881#issuecomment-227299512","issue_url":"https://api.github.com/repos/couchbase/sync_gateway/issues/1881","id":227299512,"user":{"login":"ajres","id":7745210,"avatar_url":"https://avatars.githubusercontent.com/u/7745210?v=3","gravatar_id":"","url":"https://api.github.com/users/ajres","html_url":"https://github.com/ajres","followers_url":"https://api.github.com/users/ajres/followers","following_url":"https://api.github.com/users/ajres/following{/other_user}","gists_url":"https://api.github.com/users/ajres/gists{/gist_id}","starred_url":"https://api.github.com/users/ajres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajres/subscriptions","organizations_url":"https://api.github.com/users/ajres/orgs","repos_url":"https://api.github.com/users/ajres/repos","events_url":"https://api.github.com/users/ajres/events{/privacy}","received_events_url":"https://api.github.com/users/ajres/received_events","type":"User","site_admin":false},"created_at":"2016-06-20T23:26:08Z","updated_at":"2016-06-20T23:26:08Z","body":"\n\n\n\nReviewed 2 of 2 files at r2.\nReview status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.\n\n---\n\n\n\n*Comments from [Reviewable](https://reviewable.io:443/reviews/couchbase/sync_gateway/1881)*\n<!-- Sent from Reviewable.io -->\n"}}
{"actor":{"display_login":"ajres"}}