Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-6968

Example of document expiration > 30 days

    XMLWordPrintable

Details

    Description

      While we have documentation discussing the differences between an offset expiry (< 30 days) and the epoch time for greater than 30 days, but we do not have any code examples for the epoch time approach. Can we include some code examples on how to set expiry greater than 30 days. Some example code is included below:

      Calendar calendar = Calendar.getInstance();
      calendar.add(Calendar.DAY_OF_MONTH, 60);
      Long time = calendar.getTime().getTime();
      System.out.println(time);

      try

      { MutationResult result = collection.upsert("test", JsonObject.create().put("test", "testing"), UpsertOptions.upsertOptions().expiry(Duration.ofMillis(time))); System.out.println(result); }

      catch (Exception e)

      { e.printStackTrace(); }

      Reporter: Craig Kovar
      E-mail: craig.kovar@couchbase.com

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              richard.smedley Richard Smedley
              craig.kovar Craig Kovar (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty