Skip to main content

MongoSessionsOptions

Index

Properties

optionalconvertSessionIdToMongoObjectId

convertSessionIdToMongoObjectId?: boolean

Should the session collection use _id as string or ObjectId. If 'false' must include an 'idSessionProvider'. Default 'true'.

database

database: Db

Mongo database object.

optionaldateProvider

dateProvider?: (date?: Date) => any

Function that generate the date for the timestamps. Default to (date?: Date) => (date ? date.getTime() : Date.now()).


Type declaration

    • (date?: Date): any
    • Parameters

      • optionaldate: Date

      Returns any

optionalidProvider

idProvider?: () => string | object

Function that generate the id for new User objects.


Type declaration

    • (): string | object
    • Returns string | object

optionalidSessionProvider

idSessionProvider?: () => string | object

Function that generates the _id for new Session objects. If 'undefined' then 'convertSessionIdToMongoObjectId' must be 'true'. Default 'undefined'


Type declaration

    • (): string | object
    • Returns string | object

optionalsessionCollectionName

sessionCollectionName?: string

The sessions collection name. Default 'sessions'.

optionaltimestamps

timestamps?: { createdAt: string; updatedAt: string }

The timestamps for the sessions collection. Default 'createdAt' and 'updatedAt'.


Type declaration

  • createdAt: string
  • updatedAt: string