Interface Schema

All Superinterfaces:
DatabaseObject
All Known Implementing Classes:
SchemaImpl

public interface Schema
extends DatabaseObject
A client-side representation of a database schema. Provides access to the schema contents.
  • Method Details

    • getCollections

      java.util.List<Collection> getCollections()
      Retrieve the set of collections existing in this schema.
      Returns:
      list of Collection objects
    • getCollections

      java.util.List<Collection> getCollections​(java.lang.String pattern)
      Retrieve the set of collections existing in this schema and matching the given pattern.
      Parameters:
      pattern - match pattern
      Returns:
      list of Collection objects
    • getTables

      java.util.List<Table> getTables()
      Retrieve the set of tables existing in this schema.
      Returns:
      list of Table objects
    • getTables

      java.util.List<Table> getTables​(java.lang.String pattern)
      Retrieve the set of tables existing in this schema and matching the given pattern.
      Parameters:
      pattern - match pattern
      Returns:
      list of Table objects
    • getCollection

      Collection getCollection​(java.lang.String name)
      Retrieve a reference to the named collection.
      Parameters:
      name - collection name
      Returns:
      Collection
    • getCollection

      Collection getCollection​(java.lang.String name, boolean requireExists)
      Retrieve a reference to the named collection hinting that an exception should be thrown if the collection is not known to the server.
      Parameters:
      name - collection name
      requireExists - true if required to exist
      Returns:
      Collection
    • getCollectionAsTable

      Table getCollectionAsTable​(java.lang.String name)
      Retrieve a reference to the named collection using the table API.
      Parameters:
      name - collection name
      Returns:
      Table
    • getTable

      Table getTable​(java.lang.String name)
      Retrieve a reference to the named table.
      Parameters:
      name - table name
      Returns:
      Table
    • getTable

      Table getTable​(java.lang.String tableName, boolean requireExists)
      Retrieve a reference to the named table hinting that an exception should be thrown if the collection is not known to the server.
      Parameters:
      tableName - table name
      requireExists - true if required to exist
      Returns:
      Table
    • createCollection

      Collection createCollection​(java.lang.String name)
      Create a new collection.
      Parameters:
      name - collection name
      Returns:
      Collection
    • createCollection

      Collection createCollection​(java.lang.String name, boolean reuseExisting)
      Create a new collection if it does not already exist on the server.
      Parameters:
      name - collection name
      reuseExisting - true if allowed to reuse
      Returns:
      Collection
    • createCollection

      Collection createCollection​(java.lang.String collectionName, Schema.CreateCollectionOptions options)
      Create a new collection.
      Parameters:
      collectionName - collection name
      options - reuseExisting, validation level and JSON schema options
      Returns:
      Collection
    • modifyCollection

      void modifyCollection​(java.lang.String collectionName, Schema.ModifyCollectionOptions options)
      Modify the schema validation of a collection.
      Parameters:
      collectionName - collection name
      options - validation level and JSON schema options
    • dropCollection

      void dropCollection​(java.lang.String collectionName)
      Drop the collection from this schema.
      Parameters:
      collectionName - name of collection to drop