Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CreateCollectionOptions

Options for creating a collection

Hierarchy

  • CreateCollectionOptions

Index

Constructors

constructor

Methods

getCapped

  • getCapped(): boolean
  • Optional. To create a capped collection, specify true. If you specify true, you must also set a maximum size in the size field.

    Returns boolean

getCollation

  • Specifies the default collation for the collection.

    Collation allows users to specify language-specific rules for string comparison, such as rules for lettercase and accent marks.

    Returns CollationOptions

getIndexOptionDefaults

  • getIndexOptionDefaults(): {}
  • Optional. Allows users to specify a default configuration for indexes when creating a collection.

    Returns {}

    • [key: string]: any

getMaxDocuments

  • getMaxDocuments(): number
  • Optional. The maximum number of documents allowed in the capped collection. The size limit takes precedence over this limit. If a capped collection reaches the size limit before it reaches the maximum number of documents, MongoDB removes old documents. If you prefer to use the max limit, ensure that the size limit, which is required for a capped collection, is sufficient to contain the maximum number of documents.

    Returns number

getSizeInBytes

  • getSizeInBytes(): number
  • Optional. Specify a maximum size in bytes for a capped collection. Once a capped collection reaches its maximum size, MongoDB removes the older documents to make space for the new documents. The size field is required for capped collections and ignored for other collections.

    Returns number

getStorageEngineOptions

  • getStorageEngineOptions(): {}
  • Optional. Available for the WiredTiger storage engine only.

    Allows users to specify configuration to the storage engine on a per-collection basis when creating a collection.

    Returns {}

    • [key: string]: any

getTimeSeriesOptions

  • Returns TimeSeriesOptions

getValidationOptions

  • Returns ValidationOptions

setCapped

  • Optional. To create a capped collection, specify true. If you specify true, you must also set a maximum size in the size field.

    Parameters

    • capped: boolean

    Returns CreateCollectionOptions

setCollation

  • Specifies the default collation for the collection.

    Collation allows users to specify language-specific rules for string comparison, such as rules for lettercase and accent marks.

    Parameters

    Returns CreateCollectionOptions

setIndexOptionDefaults

  • Optional. Allows users to specify a default configuration for indexes when creating a collection.

    Parameters

    • indexOptionDefaults: {}
      • [key: string]: any

    Returns CreateCollectionOptions

setMaxDocuments

  • Optional. The maximum number of documents allowed in the capped collection. The size limit takes precedence over this limit. If a capped collection reaches the size limit before it reaches the maximum number of documents, MongoDB removes old documents. If you prefer to use the max limit, ensure that the size limit, which is required for a capped collection, is sufficient to contain the maximum number of documents.

    Parameters

    • maxDocuments: number

    Returns CreateCollectionOptions

setSizeInBytes

  • Optional. Specify a maximum size in bytes for a capped collection. Once a capped collection reaches its maximum size, MongoDB removes the older documents to make space for the new documents. The size field is required for capped collections and ignored for other collections.

    Parameters

    • sizeInBytes: number

    Returns CreateCollectionOptions

setStorageEngineOptions

  • Optional. Available for the WiredTiger storage engine only.

    Allows users to specify configuration to the storage engine on a per-collection basis when creating a collection.

    Parameters

    • storageEngineOptions: {}
      • [key: string]: any

    Returns CreateCollectionOptions

setTimeSeriesOptions

setValidationOptions

toJson

  • toJson(): {}
  • Returns {}

    • [key: string]: any

Generated using TypeDoc