Package com.mongodb.operation
Class CreateCollectionOperation
- java.lang.Object
-
- com.mongodb.operation.CreateCollectionOperation
-
- All Implemented Interfaces:
AsyncWriteOperation<Void>,WriteOperation<Void>
Deprecated.
@Deprecated public class CreateCollectionOperation extends Object implements AsyncWriteOperation<Void>, WriteOperation<Void>
An operation to create a collection- Since:
- 3.0
- MongoDB documentation
- Create Collection
-
-
Constructor Summary
Constructors Constructor Description CreateCollectionOperation(String databaseName, String collectionName)Deprecated.Construct a new instance.CreateCollectionOperation(String databaseName, String collectionName, WriteConcern writeConcern)Deprecated.Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CreateCollectionOperationautoIndex(boolean autoIndex)Deprecated.Sets if _id field of the collection is indexed.CreateCollectionOperationcapped(boolean capped)Deprecated.Sets whether the collection is capped.CreateCollectionOperationcollation(Collation collation)Deprecated.Sets the collation optionsVoidexecute(WriteBinding binding)Deprecated.General execute which can return anything of type TvoidexecuteAsync(AsyncWriteBinding binding, SingleResultCallback<Void> callback)Deprecated.General execute which can return anything of type TCollationgetCollation()Deprecated.Returns the collation optionsStringgetCollectionName()Deprecated.Gets the name of the collection to create.BsonDocumentgetIndexOptionDefaults()Deprecated.Gets the index option defaults for the collection.longgetMaxDocuments()Deprecated.Gets the maximum number of documents allowed in the collection.longgetSizeInBytes()Deprecated.Gets the maximum size of the collection in bytes.BsonDocumentgetStorageEngineOptions()Deprecated.Gets the storage engine options document for this collection.ValidationActiongetValidationAction()Deprecated.Gets theValidationAction.ValidationLevelgetValidationLevel()Deprecated.Gets theValidationLevelthat determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.BsonDocumentgetValidator()Deprecated.Gets the validation rules for inserting or updating documentsWriteConcerngetWriteConcern()Deprecated.Gets the write concern.CreateCollectionOperationindexOptionDefaults(BsonDocument indexOptionDefaults)Deprecated.Sets the index option defaults document for the collection.booleanisAutoIndex()Deprecated.The auto index value.booleanisCapped()Deprecated.Gets whether the collection is capped.BooleanisUsePowerOf2Sizes()Deprecated.As of MongoDB 3.0, power of 2 sizes is ignored by the MongoDB serverCreateCollectionOperationmaxDocuments(long maxDocuments)Deprecated.Set the maximum number of documents in the collection.CreateCollectionOperationsizeInBytes(long sizeInBytes)Deprecated.Sets the maximum size of the collection in bytes.CreateCollectionOperationstorageEngineOptions(BsonDocument storageEngineOptions)Deprecated.Sets the storage engine options document for this collection.CreateCollectionOperationusePowerOf2Sizes(Boolean usePowerOf2Sizes)Deprecated.As of MongoDB 3.0, power of 2 sizes is ignored by the MongoDB serverCreateCollectionOperationvalidationAction(ValidationAction validationAction)Deprecated.Sets theValidationActionthat determines whether to error on invalid documents or just warn about the violations but allow invalid documents.CreateCollectionOperationvalidationLevel(ValidationLevel validationLevel)Deprecated.Sets the validation level that determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.CreateCollectionOperationvalidator(BsonDocument validator)Deprecated.Sets the validation rules for inserting or updating documents
-
-
-
Constructor Detail
-
CreateCollectionOperation
public CreateCollectionOperation(String databaseName, String collectionName)
Deprecated.Construct a new instance.- Parameters:
databaseName- the name of the database for the operation.collectionName- the name of the collection to be created.
-
CreateCollectionOperation
public CreateCollectionOperation(String databaseName, String collectionName, WriteConcern writeConcern)
Deprecated.Construct a new instance.- Parameters:
databaseName- the name of the database for the operation.collectionName- the name of the collection to be created.writeConcern- the write concern- Since:
- 3.4
-
-
Method Detail
-
getCollectionName
public String getCollectionName()
Deprecated.Gets the name of the collection to create.- Returns:
- the collection name
-
getWriteConcern
public WriteConcern getWriteConcern()
Deprecated.Gets the write concern.- Returns:
- the write concern, which may be null
- Since:
- 3.4
-
isAutoIndex
public boolean isAutoIndex()
Deprecated.The auto index value.- Returns:
- true if auto-index is enabled
-
autoIndex
public CreateCollectionOperation autoIndex(boolean autoIndex)
Deprecated.Sets if _id field of the collection is indexed. Only applies to capped collections and defaults to true.- Parameters:
autoIndex- true if auto-index of _id is enabled. Only applies to capped collections.- Returns:
- this
-
getMaxDocuments
public long getMaxDocuments()
Deprecated.Gets the maximum number of documents allowed in the collection.- Returns:
- max number of documents in the collection
-
maxDocuments
public CreateCollectionOperation maxDocuments(long maxDocuments)
Deprecated.Set the maximum number of documents in the collection. Only applies to capped collections- Parameters:
maxDocuments- the maximum number of documents in the collection. Only applies to capped collections.- Returns:
- this
-
isCapped
public boolean isCapped()
Deprecated.Gets whether the collection is capped.- Returns:
- whether the collection is capped
-
capped
public CreateCollectionOperation capped(boolean capped)
Deprecated.Sets whether the collection is capped. Capped collections also require the size set seesizeInBytes.- Parameters:
capped- whether the collection is capped. Defaults to false.- Returns:
- this
-
getSizeInBytes
public long getSizeInBytes()
Deprecated.Gets the maximum size of the collection in bytes.- Returns:
- the maximum size of the collection
-
sizeInBytes
public CreateCollectionOperation sizeInBytes(long sizeInBytes)
Deprecated.Sets the maximum size of the collection in bytes. Required for capped collections.- Parameters:
sizeInBytes- the maximum size of the collection- Returns:
- this
-
isUsePowerOf2Sizes
@Deprecated public Boolean isUsePowerOf2Sizes()
Deprecated. As of MongoDB 3.0, power of 2 sizes is ignored by the MongoDB serverGets whether usePowerOf2Sizes should be used foe the allocation strategy.Note: usePowerOf2Sizes} became the default allocation strategy in mongodb 2.6
- Returns:
- usePowerOf2Sizes became the default allocation strategy
- MongoDB documentation
- usePowerOf2Sizes
- Since server release
- 2.6
-
usePowerOf2Sizes
@Deprecated public CreateCollectionOperation usePowerOf2Sizes(Boolean usePowerOf2Sizes)
Deprecated. As of MongoDB 3.0, power of 2 sizes is ignored by the MongoDB serverSets whether usePowerOf2Sizes should be used foe the allocation strategy.Note: usePowerOf2Sizes} became the default allocation strategy in mongodb 2.6
- Parameters:
usePowerOf2Sizes- as the default allocation strategy- Returns:
- this
- MongoDB documentation
- usePowerOf2Sizes
- Since server release
- 2.6
-
getStorageEngineOptions
public BsonDocument getStorageEngineOptions()
Deprecated.Gets the storage engine options document for this collection.- Returns:
- the storage engine options
- Since server release
- 3.0
-
storageEngineOptions
public CreateCollectionOperation storageEngineOptions(BsonDocument storageEngineOptions)
Deprecated.Sets the storage engine options document for this collection.- Parameters:
storageEngineOptions- the storage engine options- Returns:
- this
- Since server release
- 3.0
-
getIndexOptionDefaults
public BsonDocument getIndexOptionDefaults()
Deprecated.Gets the index option defaults for the collection.- Returns:
- the index option defaults
- Since:
- 3.2
- Since server release
- 3.2
-
indexOptionDefaults
public CreateCollectionOperation indexOptionDefaults(BsonDocument indexOptionDefaults)
Deprecated.Sets the index option defaults document for the collection.- Parameters:
indexOptionDefaults- the index option defaults- Returns:
- this
- Since:
- 3.2
- Since server release
- 3.2
-
getValidator
public BsonDocument getValidator()
Deprecated.Gets the validation rules for inserting or updating documents- Returns:
- the validation rules if set or null
- Since:
- 3.2
- Since server release
- 3.2
-
validator
public CreateCollectionOperation validator(BsonDocument validator)
Deprecated.Sets the validation rules for inserting or updating documents- Parameters:
validator- the validation rules for inserting or updating documents- Returns:
- this
- Since:
- 3.2
- Since server release
- 3.2
-
getValidationLevel
public ValidationLevel getValidationLevel()
Deprecated.Gets theValidationLevelthat determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.- Returns:
- the ValidationLevel if set or null
- Since:
- 3.2
- Since server release
- 3.2
-
validationLevel
public CreateCollectionOperation validationLevel(ValidationLevel validationLevel)
Deprecated.Sets the validation level that determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.- Parameters:
validationLevel- the validation level- Returns:
- this
- Since:
- 3.2
- Since server release
- 3.2
-
getValidationAction
public ValidationAction getValidationAction()
Deprecated.Gets theValidationAction.- Returns:
- the ValidationAction if set or null
- Since:
- 3.2
- Since server release
- 3.2
-
validationAction
public CreateCollectionOperation validationAction(ValidationAction validationAction)
Deprecated.Sets theValidationActionthat determines whether to error on invalid documents or just warn about the violations but allow invalid documents.- Parameters:
validationAction- the validation action- Returns:
- this
- Since:
- 3.2
- Since server release
- 3.2
-
getCollation
public Collation getCollation()
Deprecated.Returns the collation options- Returns:
- the collation options
- Since:
- 3.4
- Since server release
- 3.4
-
collation
public CreateCollectionOperation collation(Collation collation)
Deprecated.Sets the collation optionsA null value represents the server default.
- Parameters:
collation- the collation options to use- Returns:
- this
- Since:
- 3.4
- Since server release
- 3.4
-
execute
public Void execute(WriteBinding binding)
Deprecated.Description copied from interface:WriteOperationGeneral execute which can return anything of type T- Specified by:
executein interfaceWriteOperation<Void>- Parameters:
binding- the binding to execute in the context of- Returns:
- T, the result of the execution
-
executeAsync
public void executeAsync(AsyncWriteBinding binding, SingleResultCallback<Void> callback)
Deprecated.Description copied from interface:AsyncWriteOperationGeneral execute which can return anything of type T- Specified by:
executeAsyncin interfaceAsyncWriteOperation<Void>- Parameters:
binding- the binding to execute in the context ofcallback- the callback to be called when the operation has been executed
-
-