Class CreateCollectionOperation

    • 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 see sizeInBytes.
        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 server
        Gets 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 server
        Sets 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 the ValidationLevel 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. 
        Returns:
        the ValidationAction if set or null
        Since:
        3.2
        Since server release
        3.2
      • validationAction

        public CreateCollectionOperation validationAction​(ValidationAction validationAction)
        Deprecated. 
        Sets the ValidationAction 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 options

        A 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 interface WriteOperation<Void>
        Parameters:
        binding - the binding to execute in the context of
        Returns:
        T, the result of the execution