public class CollectionOptions extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CollectionOptions.ValidationOptions
Encapsulation of ValidationOptions options.
|
| Constructor and Description |
|---|
CollectionOptions(Long size,
Long maxDocuments,
Boolean capped)
Deprecated.
since 2.0 please use
empty() as entry point. |
| Modifier and Type | Method and Description |
|---|---|
CollectionOptions |
capped()
Create new
CollectionOptions with already given settings and capped set to true. |
CollectionOptions |
collation(Collation collation)
Create new
CollectionOptions with already given settings and collation set to given value. |
CollectionOptions |
disableValidation()
Create new
CollectionOptions with already given settings and validationLevel set to
ValidationLevel.OFF. |
static CollectionOptions |
empty()
Create new empty
CollectionOptions. |
CollectionOptions |
failOnValidationError()
Create new
CollectionOptions with already given settings and validationAction set to
ValidationAction.ERROR. |
Optional<Boolean> |
getCapped()
Get if the collection should be capped.
|
Optional<Collation> |
getCollation()
Get the
Collation settings. |
Optional<Long> |
getMaxDocuments()
Get the max number of documents the collection should be limited to.
|
Optional<Long> |
getSize()
Get the size in bytes the collection should be limited to.
|
Optional<CollectionOptions.ValidationOptions> |
getValidationOptions()
Get the
MongoJsonSchema for the collection. |
static CollectionOptions |
just(Collation collation)
Create new
CollectionOptions by just providing the Collation to use. |
CollectionOptions |
maxDocuments(long maxDocuments)
Create new
CollectionOptions with already given settings and maxDocuments set to given value. |
CollectionOptions |
moderateValidation()
Create new
CollectionOptions with already given settings and validationLevel set to
ValidationLevel.MODERATE. |
CollectionOptions |
schema(MongoJsonSchema schema)
Create new
CollectionOptions with already given settings and validationOptions set to given
MongoJsonSchema. |
CollectionOptions |
schemaValidationAction(com.mongodb.client.model.ValidationAction validationAction)
Create new
CollectionOptions with already given settings and validationAction set given
ValidationAction. |
CollectionOptions |
schemaValidationLevel(com.mongodb.client.model.ValidationLevel validationLevel)
Create new
CollectionOptions with already given settings and validationLevel set given
ValidationLevel. |
CollectionOptions |
size(long size)
Create new
CollectionOptions with already given settings and size set to given value. |
CollectionOptions |
strictValidation()
Create new
CollectionOptions with already given settings and validationLevel set to
ValidationLevel.STRICT. |
CollectionOptions |
validation(CollectionOptions.ValidationOptions validationOptions)
Create new
CollectionOptions with the given CollectionOptions.ValidationOptions. |
CollectionOptions |
validator(Validator validator)
Create new
CollectionOptions with already given settings and validationOptions set to given
Validator. |
CollectionOptions |
warnOnValidationError()
Create new
CollectionOptions with already given settings and validationAction set to
ValidationAction.WARN. |
@Deprecated public CollectionOptions(@Nullable Long size, @Nullable Long maxDocuments, @Nullable Boolean capped)
empty() as entry point.CollectionOptions instance.size - the collection size in bytes, this data space is preallocated. Can be null.maxDocuments - the maximum number of documents in the collection. Can be null.capped - true to created a "capped" collection (fixed size with auto-FIFO behavior based on insertion order),
false otherwise. Can be null.public static CollectionOptions just(Collation collation)
CollectionOptions by just providing the Collation to use.collation - must not be null.CollectionOptions.public static CollectionOptions empty()
CollectionOptions.CollectionOptions.public CollectionOptions capped()
CollectionOptions with already given settings and capped set to true. #size(int).CollectionOptions.public CollectionOptions maxDocuments(long maxDocuments)
CollectionOptions with already given settings and maxDocuments set to given value.maxDocuments - can be null.CollectionOptions.public CollectionOptions size(long size)
CollectionOptions with already given settings and size set to given value.size - can be null.CollectionOptions.public CollectionOptions collation(@Nullable Collation collation)
CollectionOptions with already given settings and collation set to given value.collation - can be null.CollectionOptions.public CollectionOptions schema(@Nullable MongoJsonSchema schema)
CollectionOptions with already given settings and validationOptions set to given
MongoJsonSchema.schema - can be null.CollectionOptions.public CollectionOptions validator(@Nullable Validator validator)
CollectionOptions with already given settings and validationOptions set to given
Validator.validator - can be null.CollectionOptions.public CollectionOptions disableValidation()
CollectionOptions with already given settings and validationLevel set to
ValidationLevel.OFF.CollectionOptions.public CollectionOptions strictValidation()
CollectionOptions with already given settings and validationLevel set to
ValidationLevel.STRICT.CollectionOptions.public CollectionOptions moderateValidation()
CollectionOptions with already given settings and validationLevel set to
ValidationLevel.MODERATE.CollectionOptions.public CollectionOptions warnOnValidationError()
CollectionOptions with already given settings and validationAction set to
ValidationAction.WARN.CollectionOptions.public CollectionOptions failOnValidationError()
CollectionOptions with already given settings and validationAction set to
ValidationAction.ERROR.CollectionOptions.public CollectionOptions schemaValidationLevel(com.mongodb.client.model.ValidationLevel validationLevel)
CollectionOptions with already given settings and validationLevel set given
ValidationLevel.validationLevel - must not be null.CollectionOptions.public CollectionOptions schemaValidationAction(com.mongodb.client.model.ValidationAction validationAction)
CollectionOptions with already given settings and validationAction set given
ValidationAction.validationAction - must not be null.CollectionOptions.public CollectionOptions validation(CollectionOptions.ValidationOptions validationOptions)
CollectionOptions with the given CollectionOptions.ValidationOptions.validationOptions - must not be null. Use CollectionOptions.ValidationOptions.none() to remove validation.CollectionOptions.public Optional<Long> getMaxDocuments()
Optional.empty() if not set.public Optional<Long> getSize()
Optional.empty() if not set.public Optional<Boolean> getCapped()
Optional.empty() if not set.public Optional<Collation> getCollation()
Collation settings.Optional.empty() if not set.public Optional<CollectionOptions.ValidationOptions> getValidationOptions()
MongoJsonSchema for the collection.Optional.empty() if not set.Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.