接口 Schema

  • 所有超级接口:
    DatabaseObject
    所有已知实现类:
    SchemaImpl

    public interface Schema
    extends DatabaseObject
    A client-side representation of a database schema. Provides access to the schema contents.
    • 方法详细资料

      • getCollections

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

        List<Collection> getCollections​(String pattern)
        Retrieve the set of collections existing in this schema and matching the given pattern.
        参数:
        pattern - match pattern
        返回:
        list of Collection objects
      • getTables

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

        List<Table> getTables​(String pattern)
        Retrieve the set of tables existing in this schema and matching the given pattern.
        参数:
        pattern - match pattern
        返回:
        list of Table objects
      • getCollection

        Collection getCollection​(String name)
        Retrieve a reference to the named collection.
        参数:
        name - collection name
        返回:
        Collection
      • getCollection

        Collection getCollection​(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.
        参数:
        name - collection name
        requireExists - true if required to exist
        返回:
        Collection
      • getCollectionAsTable

        Table getCollectionAsTable​(String name)
        Retrieve a reference to the named collection using the table API.
        参数:
        name - collection name
        返回:
        Table
      • getTable

        Table getTable​(String name)
        Retrieve a reference to the named table.
        参数:
        name - table name
        返回:
        Table
      • getTable

        Table getTable​(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.
        参数:
        tableName - table name
        requireExists - true if required to exist
        返回:
        Table
      • createCollection

        Collection createCollection​(String name)
        Create a new collection.
        参数:
        name - collection name
        返回:
        Collection
      • createCollection

        Collection createCollection​(String name,
                                    boolean reuseExisting)
        Create a new collection if it does not already exist on the server.
        参数:
        name - collection name
        reuseExisting - true if allowed to reuse
        返回:
        Collection
      • modifyCollection

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

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