Parameters
Inherits:
  • «NodeJS EventEmitter

Example:

Options:

  • autoIndex: bool - defaults to null (which means use the connection’s autoIndex option)
  • : bool - defaults to null (which means use the connection’s autoCreate option)
  • bufferTimeoutMS: number - defaults to 10000 (10 seconds). If is enabled, the amount of time Mongoose will wait for connectivity to be restablished before erroring out.
  • : bool - defaults to false
  • collection: string - no default
  • : bool - defaults to true
  • _id: bool - defaults to true
  • : bool - controls document#toObject behavior when called manually - defaults to true
  • : string
  • writeConcern: object - defaults to null, use to override
  • shardKey: object - defaults to null
  • : bool - defaults to true
  • strictQuery: bool - defaults to false
  • - object - no default
  • typeKey - string - defaults to ‘type’
  • - boolean - defaults to true. Determines whether a type set to a POJO becomes a Mixed path or a Subdocument
  • useNestedStrict - boolean - defaults to false
  • - bool - defaults to true
  • versionKey: string or object - defaults to “__v”
  • : bool - defaults to false. Set to true to enable optimistic concurrency.
  • : object - defaults to null (which means use no collation)
  • selectPopulatedPaths: boolean - defaults to
  • : object - paths to exclude from versioning
  • timestamps: object or boolean - defaults to false. If true, Mongoose adds createdAt and properties to your schema and manages those properties for you.

Options for Nested Schemas:

  • excludeIndexes: bool - defaults to false. If , skip building indexes on this schema’s paths.

Note: