Package com.mongodb.operation
Class CreateCollectionOperation
-
- com.mongodb.operation.CreateCollectionOperation
-
- All Implemented Interfaces:
>
,>
public class CreateCollectionOperation extends implements >, >
Deprecated.An operation to create a collection- Since:
- 3.0
- MongoDB documentation
-
-
Constructor Summary
Constructors Constructor Description databaseName, collectionName)
Deprecated.Construct a new instance.databaseName, 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 optionsexecute(WriteBinding binding)
Deprecated.General execute which can return anything of type Tvoid
executeAsync(AsyncWriteBinding binding, > callback)
Deprecated.General execute which can return anything of type TCollation
getCollation()
Deprecated.Returns the collation optionsgetCollectionName()
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.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)
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( databaseName, 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( databaseName, 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 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
public 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
- Since server release
-
usePowerOf2Sizes
public 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
- Since server release
-
getStorageEngineOptions
public BsonDocument getStorageEngineOptions()
Deprecated.Gets the storage engine options document for this collection.- Returns:
- the storage engine options
- Since server release
-
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
-
getIndexOptionDefaults
public BsonDocument getIndexOptionDefaults()
Deprecated.Gets the index option defaults for the collection.- Returns:
- the index option defaults
- Since:
- 3.2
- Since server release
-
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
-
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
-
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
-
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
-
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
-
getValidationAction
public ValidationAction getValidationAction()
Deprecated.Gets theValidationAction
.- Returns:
- the ValidationAction if set or null
- Since:
- 3.2
- Since server release
-
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
-
getCollation
public Collation getCollation()
Deprecated.Returns the collation options- Returns:
- the collation options
- Since:
- 3.4
- Since server release
-
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
-
execute
public execute(WriteBinding binding)
Deprecated.Description copied from interface:WriteOperation
General execute which can return anything of type T- Specified by:
>
- Parameters:
binding
- the binding to execute in the context of- Returns:
- T, the result of the execution
-
executeAsync
public void executeAsync(AsyncWriteBinding binding, > callback)
Deprecated.Description copied from interface:AsyncWriteOperation
General execute which can return anything of type T- Specified by:
>
- Parameters:
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executed
-
-