Mongo

@accounts/mongoGlobalsMongo

Hierarchy

  • Mongo

Implements

  • DatabaseInterface

Index

Constructors

Methods

Constructors

constructor

+ new Mongo(db: any, options: AccountsMongoOptions): Mongo

Defined in mongo.ts:42

Parameters:

NameTypeDefault
dbany-
optionsAccountsMongoOptions{}

Returns: Mongo

Methods

addEmail

addEmail(userId: string, newEmail: string, verified: boolean): Promise‹void›

Defined in mongo.ts:95

Parameters:

NameType
userIdstring
newEmailstring
verifiedboolean

Returns: Promise‹void›


addEmailVerificationToken

addEmailVerificationToken(userId: string, email: string, token: string): Promise‹void›

Defined in mongo.ts:119

Parameters:

NameType
userIdstring
emailstring
tokenstring

Returns: Promise‹void›


addResetPasswordToken

addResetPasswordToken(userId: string, email: string, token: string, reason: string): Promise‹void›

Defined in mongo.ts:127

Parameters:

NameType
userIdstring
emailstring
tokenstring
reasonstring

Returns: Promise‹void›


createSession

createSession(userId: string, token: string, connection: ConnectionInformations, extraData?: object): Promise‹string›

Defined in mongo.ts:136

Parameters:

NameTypeDefault
userIdstring-
tokenstring-
connectionConnectionInformations{}
extraData?object-

Returns: Promise‹string›


createUser

createUser(user: CreateUserServicePassword): Promise‹string›

Defined in mongo.ts:72

Parameters:

NameType
userCreateUserServicePassword

Returns: Promise‹string›


findPasswordHash

findPasswordHash(userId: string): Promise‹string | null›

Defined in mongo.ts:83

Parameters:

NameType
userIdstring

Returns: Promise‹string | null›


findSessionById

findSessionById(sessionId: string): Promise‹Session | null›

Defined in mongo.ts:145

Parameters:

NameType
sessionIdstring

Returns: Promise‹Session | null›


findSessionByToken

findSessionByToken(token: string): Promise‹Session | null›

Defined in mongo.ts:149

Parameters:

NameType
tokenstring

Returns: Promise‹Session | null›


findUserByEmail

findUserByEmail(email: string): Promise‹User | null›

Defined in mongo.ts:76

Parameters:

NameType
emailstring

Returns: Promise‹User | null›


findUserByEmailVerificationToken

findUserByEmailVerificationToken(token: string): Promise‹User | null›

Defined in mongo.ts:87

Parameters:

NameType
tokenstring

Returns: Promise‹User | null›


findUserById

findUserById(userId: string): Promise‹User | null›

Defined in mongo.ts:68

Parameters:

NameType
userIdstring

Returns: Promise‹User | null›


findUserByResetPasswordToken

findUserByResetPasswordToken(token: string): Promise‹User | null›

Defined in mongo.ts:91

Parameters:

NameType
tokenstring

Returns: Promise‹User | null›


findUserByServiceId

findUserByServiceId(serviceName: string, serviceId: string): Promise‹User | null›

Defined in mongo.ts:169

Parameters:

NameType
serviceNamestring
serviceIdstring

Returns: Promise‹User | null›


findUserByUsername

findUserByUsername(username: string): Promise‹User | null›

Defined in mongo.ts:79

Parameters:

NameType
usernamestring

Returns: Promise‹User | null›


invalidateAllSessions

invalidateAllSessions(userId: string, excludedSessionIds?: string[]): Promise‹void›

Defined in mongo.ts:165

Parameters:

NameType
userIdstring
excludedSessionIds?string[]

Returns: Promise‹void›


invalidateSession

invalidateSession(sessionId: string): Promise‹void›

Defined in mongo.ts:161

Parameters:

NameType
sessionIdstring

Returns: Promise‹void›


removeAllResetPasswordTokens

removeAllResetPasswordTokens(userId: string): Promise‹void›

Defined in mongo.ts:115

Parameters:

NameType
userIdstring

Returns: Promise‹void›


removeEmail

removeEmail(userId: string, email: string): Promise‹void›

Defined in mongo.ts:99

Parameters:

NameType
userIdstring
emailstring

Returns: Promise‹void›


setPassword

setPassword(userId: string, newPassword: string): Promise‹void›

Defined in mongo.ts:111

Parameters:

NameType
userIdstring
newPasswordstring

Returns: Promise‹void›


setService

setService(userId: string, serviceName: string, service: object): Promise‹void›

Defined in mongo.ts:179

Parameters:

NameType
userIdstring
serviceNamestring
serviceobject

Returns: Promise‹void›


setUserDeactivated

setUserDeactivated(userId: string, deactivated: boolean): Promise‹void›

Defined in mongo.ts:207

Parameters:

NameType
userIdstring
deactivatedboolean

Returns: Promise‹void›


setUsername

setUsername(userId: string, newUsername: string): Promise‹void›

Defined in mongo.ts:107

Parameters:

NameType
userIdstring
newUsernamestring

Returns: Promise‹void›


setupIndexes

setupIndexes(options: Omit‹IndexOptions, "unique" | "sparse"›): Promise‹void›

Defined in mongo.ts:63

Setup the mongo indexes needed.

Parameters:

NameTypeDefaultDescription
optionsOmit‹IndexOptions, "unique" | "sparse"›{}Options passed to the mongo native createIndex method.

Returns: Promise‹void›


unsetService

unsetService(userId: string, serviceName: string): Promise‹void›

Defined in mongo.ts:192

Parameters:

NameType
userIdstring
serviceNamestring

Returns: Promise‹void›


updateSession

updateSession(sessionId: string, connection: ConnectionInformations, newToken?: string): Promise‹void›

Defined in mongo.ts:153

Parameters:

NameType
sessionIdstring
connectionConnectionInformations
newToken?string

Returns: Promise‹void›


verifyEmail

verifyEmail(userId: string, email: string): Promise‹void›

Defined in mongo.ts:103

Parameters:

NameType
userIdstring
emailstring

Returns: Promise‹void›