Package com.mongodb.operation
Class CreateCollectionOperation
java.lang.Object
com.mongodb.operation.CreateCollectionOperation
- All Implemented Interfaces:
AsyncWriteOperation<Void>
,WriteOperation<Void>
@Deprecated
public class CreateCollectionOperation
extends Object
implements AsyncWriteOperation<Void>, WriteOperation<Void>
Deprecated.
An operation to create a collection
- Since:
- 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreateCollectionOperation
(String databaseName, String collectionName) Deprecated.Construct a new instance.CreateCollectionOperation
(String databaseName, String collectionName, WriteConcern writeConcern) Deprecated.Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionautoIndex
(boolean autoIndex) Deprecated.Sets if _id field of the collection is indexed.capped
(boolean capped) Deprecated.Sets whether the collection is capped.Deprecated.Sets the collation optionsexecute
(WriteBinding binding) Deprecated.General execute which can return anything of type Tvoid
executeAsync
(AsyncWriteBinding binding, SingleResultCallback<Void> callback) Deprecated.General execute which can return anything of type TDeprecated.Returns the collation optionsDeprecated.Gets the name of the collection to create.Deprecated.Gets the index option defaults for the collection.long
Deprecated.Gets the maximum number of documents allowed in the collection.long
Deprecated.Gets the maximum size of the collection in bytes.Deprecated.Gets the storage engine options document for this collection.Deprecated.Gets theValidationAction
.Deprecated.Gets theValidationLevel
that determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.Deprecated.Gets the validation rules for inserting or updating documentsDeprecated.Gets the write concern.indexOptionDefaults
(BsonDocument indexOptionDefaults) Deprecated.Sets the index option defaults document for the collection.boolean
Deprecated.The auto index value.boolean
isCapped()
Deprecated.Gets whether the collection is capped.Deprecated.As of MongoDB 3.0, power of 2 sizes is ignored by the MongoDB servermaxDocuments
(long maxDocuments) Deprecated.Set the maximum number of documents in the collection.sizeInBytes
(long sizeInBytes) Deprecated.Sets the maximum size of the collection in bytes.storageEngineOptions
(BsonDocument storageEngineOptions) Deprecated.Sets the storage engine options document for this collection.usePowerOf2Sizes
(Boolean usePowerOf2Sizes) Deprecated.As of MongoDB 3.0, power of 2 sizes is ignored by the MongoDB servervalidationAction
(ValidationAction validationAction) Deprecated.Sets theValidationAction
that determines whether to error on invalid documents or just warn about the violations but allow invalid documents.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.validator
(BsonDocument validator) Deprecated.Sets the validation rules for inserting or updating documents
-
Constructor Details
-
CreateCollectionOperation
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 Details
-
getCollectionName
Deprecated.Gets the name of the collection to create.- Returns:
- the collection name
-
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
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
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
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
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.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
-
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
-
getStorageEngineOptions
Deprecated.Gets the storage engine options document for this collection.- Returns:
- the storage engine options
-
storageEngineOptions
Deprecated.Sets the storage engine options document for this collection.- Parameters:
storageEngineOptions
- the storage engine options- Returns:
- this
-
getIndexOptionDefaults
Deprecated.Gets the index option defaults for the collection.- Returns:
- the index option defaults
- Since:
- 3.2
-
indexOptionDefaults
Deprecated.Sets the index option defaults document for the collection.- Parameters:
indexOptionDefaults
- the index option defaults- Returns:
- this
- Since:
- 3.2
-
getValidator
Deprecated.Gets the validation rules for inserting or updating documents- Returns:
- the validation rules if set or null
- Since:
- 3.2
-
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
-
getValidationLevel
Deprecated.Gets theValidationLevel
that 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
-
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
-
getValidationAction
Deprecated.Gets theValidationAction
.- Returns:
- the ValidationAction if set or null
- Since:
- 3.2
-
validationAction
Deprecated.Sets theValidationAction
that 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
-
getCollation
Deprecated.Returns the collation options- Returns:
- the collation options
- Since:
- 3.4
-
collation
Deprecated.Sets the collation optionsA null value represents the server default.
- Parameters:
collation
- the collation options to use- Returns:
- this
- Since:
- 3.4
-
execute
Deprecated.Description copied from interface:WriteOperation
General execute which can return anything of type T- Specified by:
execute
in interfaceWriteOperation<Void>
- Parameters:
binding
- the binding to execute in the context of- Returns:
- T, the result of the execution
-
executeAsync
Deprecated.Description copied from interface:AsyncWriteOperation
General execute which can return anything of type T- Specified by:
executeAsync
in interfaceAsyncWriteOperation<Void>
- Parameters:
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed
-