com.mysql.cj.xdevapi

## Class Schema.CreateCollectionOptions

- java.lang.Object
- - com.mysql.cj.xdevapi.Schema.CreateCollectionOptions

Enclosing interface:
  Schema

    public static class Schema.CreateCollectionOptions
    extends Object

Defines options to be passed to `Schema.createCollection(String, CreateCollectionOptions)`.

Allowed options are:

- reuseExisting flag - similar to IF NOT EXISTS for CREATE TABLE
- `Schema.Validation` object

Examples:

     schema.createCollection(collName,
             new CreateCollectionOptions().setReuseExisting(false)
                     .setValidation(new Validation().setLevel(ValidationLevel.STRICT)
                             .setSchema("{\"id\": \"http://json-schema.org/idx\", \"$schema\": \"http://json-schema.org/draft-06/schema#\","
                                     + "\"type\": \"object\", \"properties\": {\"index\": {\"type\": \"number\"}},\"required\": [\"index\"]}")));

     schema.createCollection(collName, new CreateCollectionOptions().setReuseExisting(false).setValidation(new Validation().setLevel(ValidationLevel.OFF)));

     schema.createCollection(collName,
             new CreateCollectionOptions().setReuseExisting(true);

### Field Summary

Fields
`private Boolean` `reuseExisting`
`private Schema.Validation` `validation`

### Constructor Summary

Constructors
Constructor and Description
`CreateCollectionOptions()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Boolean` `getReuseExisting()`
`Schema.Validation` `getValidation()`
`Schema.CreateCollectionOptions` `setReuseExisting(boolean reuse)`
`Schema.CreateCollectionOptions` `setValidation(Schema.Validation validation)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### reuseExisting

    private Boolean reuseExisting

#### validation

    private Schema.Validation validation

### Constructor Detail

#### CreateCollectionOptions

    public CreateCollectionOptions()

### Method Detail

#### setReuseExisting

    public Schema.CreateCollectionOptions setReuseExisting(boolean reuse)

#### getReuseExisting

    public Boolean getReuseExisting()

#### setValidation

    public Schema.CreateCollectionOptions setValidation(Schema.Validation validation)

#### getValidation

    public Schema.Validation getValidation()

Copyright © 2016, 2023, Oracle and/or its affiliates.