Collections & Scope

  • Developer Preview
    +
    Available as a Developer Preview in Couchbase Server 6.5.

    The Developer Preview of the upcoming Collections feature in Couchbase Server is fully implemented in the 3.0 API versions of the Couchbase SDKs. Information on the Developer Preview (DP) of Collections can be found in the server docs.

    Using Collections & Scope DP

    Access a non-default collection, in the default scope, with:

        collection = bucket.collection("flights"); // in default scope
        // #end::collections_1[];
      }
    
      public void collections_2() throws Exception {
        collection = bucket.scope("marlowe_agency").collection("flights");
        // #end::collections_2[];
      }
    
      public static void main(String[] args) throws Exception {
        CollectionsExample obj = new CollectionsExample();
        obj.init();
        obj.collections_1();
        obj.collections_2();
        System.out.println("Done.");
      }
    }

    And for a non-default scope:

        collection = bucket.scope("marlowe_agency").collection("flights");
        // #end::collections_2[];
      }
    
      public static void main(String[] args) throws Exception {
        CollectionsExample obj = new CollectionsExample();
        obj.init();
        obj.collections_1();
        obj.collections_2();
        System.out.println("Done.");
      }
    }