connect-mongo
- Version 5.1.0
- Published
- 730 kB
- 2 dependencies
- MIT license
Install
npm i connect-mongo
yarn add connect-mongo
pnpm add connect-mongo
Overview
MongoDB session store for Express and Connect
Index
Classes
class MongoStore
class MongoStore extends session.Store {}
constructor
constructor({ collectionName, ttl, mongoOptions, autoRemove, autoRemoveInterval, touchAfter, stringify, crypto, ...required}: ConnectMongoOptions);
property collectionP
collectionP: Promise<Collection<InternalSessionType>>;
method all
all: ( callback: ( err: any, obj?: session.SessionData[] | { [sid: string]: session.SessionData } ) => void) => void;
Get all sessions in the store as an array
method clear
clear: (callback?: (err: any) => void) => void;
Delete all sessions from the store.
method close
close: () => Promise<void>;
Close database connection
method create
static create: (options: ConnectMongoOptions) => MongoStore;
method destroy
destroy: (sid: string, callback?: (err: any) => void) => void;
Destroy/delete a session from the store given a session ID (sid)
Parameter sid
session ID
method get
get: (sid: string, callback: (err: any, session?: any) => void) => void;
Get a session from the store given a session ID (sid)
Parameter sid
session ID
method length
length: (callback: (err: any, length: number) => void) => void;
Get the count of all sessions in the store
method set
set: ( sid: string, session: session.SessionData, callback?: (err: any) => void) => void;
Upsert a session into the store given a session ID (sid) and session (session) object.
Parameter sid
session ID
Parameter session
session object
method touch
touch: ( sid: string, session: session.SessionData & { lastModified?: Date }, callback?: (err: any) => void) => void;
Namespaces
namespace kruptein
module 'kruptein' {}
If you import a dependency which does not include its own type definitions, TypeScript will try to find a definition for it by following the
typeRoots
compiler option in tsconfig.json. For this project, we've configured it to fall back to this folder if nothing is found in node_modules/@types.Often, you can install the DefinitelyTyped (https://github.com/DefinitelyTyped/DefinitelyTyped) type definition for the dependency in question. However, if no one has yet contributed definitions for the package, you may want to declare your own. (If you're using the
noImplicitAny
compiler options, you'll be required to declare it.)This is an example type definition which allows import from
module-name
, e.g.:import something from 'module-name';something();
Package Files (3)
Dependencies (2)
Dev Dependencies (40)
- @ava/typescript
- @commitlint/cli
- @commitlint/config-conventional
- @istanbuljs/nyc-config-typescript
- @types/debug
- @types/express
- @types/express-session
- @types/node
- @types/supertest
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- ava
- codecov
- cspell
- cz-conventional-changelog
- eslint
- eslint-config-prettier
- eslint-config-prettier-standard
- eslint-config-standard
- eslint-plugin-eslint-comments
- eslint-plugin-import
- eslint-plugin-node
- eslint-plugin-prettier
- eslint-plugin-promise
- eslint-plugin-standard
- express
- express-session
- gh-pages
- husky
- lint-staged
- mongodb
- npm-run-all
- nyc
- open-cli
- prettier
- standard-version
- supertest
- ts-node
- typedoc
- typescript
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/connect-mongo
.
- Markdown[](https://www.jsdocs.io/package/connect-mongo)
- HTML<a href="https://www.jsdocs.io/package/connect-mongo"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2940 ms. - Missing or incorrect documentation? Open an issue for this package.