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 CreateCollectionOperation
autoIndex(boolean autoIndex)
Deprecated.Sets if _id field of the collection is indexed.CreateCollectionOperation
capped(boolean capped)
Deprecated.Sets whether the collection is capped.CreateCollectionOperation
collation(Collation collation)
Deprecated.Sets the collation optionsVoid
execute(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 TCollation
getCollation()
Deprecated.Returns the collation optionsString
getCollectionName()
Deprecated.Gets the name of the collection to create.BsonDocument
getIndexOptionDefaults()
Deprecated.Gets the index option defaults for the collection.long
getMaxDocuments()
Deprecated.Gets the maximum number of documents allowed in the collection.long
getSizeInBytes()
Deprecated.Gets the maximum size of the collection in bytes.BsonDocument
getStorageEngineOptions()
Deprecated.Gets the storage engine options document for this collection.ValidationAction
getValidationAction()
Deprecated.Gets theValidationAction
.ValidationLevel
getValidationLevel()
Deprecated.Gets theValidationLevel
that determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.BsonDocument
getValidator()
Deprecated.Gets the validation rules for inserting or updating documentsWriteConcern
getWriteConcern()
Deprecated.Gets the write concern.CreateCollectionOperation
indexOptionDefaults(BsonDocument indexOptionDefaults)
Deprecated.Sets the index option defaults document for the collection.boolean
isAutoIndex()
Deprecated.The auto index value.boolean
isCapped()
Deprecated.Gets whether the collection is capped.Boolean
isUsePowerOf2Sizes()
Deprecated.As of MongoDB 3.0, power of 2 sizes is ignored by the MongoDB serverCreateCollectionOperation
maxDocuments(long maxDocuments)
Deprecated.Set the maximum number of documents in the collection.CreateCollectionOperation
sizeInBytes(long sizeInBytes)
Deprecated.Sets the maximum size of the collection in bytes.CreateCollectionOperation
storageEngineOptions(BsonDocument storageEngineOptions)
Deprecated.Sets the storage engine options document for this collection.CreateCollectionOperation
usePowerOf2Sizes(Boolean usePowerOf2Sizes)
Deprecated.As of MongoDB 3.0, power of 2 sizes is ignored by the MongoDB serverCreateCollectionOperation
validationAction(ValidationAction validationAction)
Deprecated.Sets theValidationAction
that determines whether to error on invalid documents or just warn about the violations but allow invalid documents.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.CreateCollectionOperation
validator(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 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
- 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 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
- 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: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
public void executeAsync(AsyncWriteBinding binding, SingleResultCallback<Void> callback)
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
-
-