Mongo

@accounts/mongoGlobalsMongo

Hierarchy

  • Mongo

Implements

  • DatabaseInterface

Index

Constructors

Methods

Constructors

constructor

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

Defined in mongo.ts:41

Parameters:

NameType
dbany
options?AccountsMongoOptions

Returns: Mongo

Methods

addEmail

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

Defined in mongo.ts:182

Parameters:

NameType
userIdstring
newEmailstring
verifiedboolean

Returns: Promise‹void›


addEmailVerificationToken

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

Defined in mongo.ts:425

Parameters:

NameType
userIdstring
emailstring
tokenstring

Returns: Promise‹void›


addResetPasswordToken

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

Defined in mongo.ts:445

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:312

Parameters:

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

Returns: Promise‹string›


createUser

createUser(__namedParameters: object): Promise‹string›

Defined in mongo.ts:84

Parameters:

__namedParameters: object

NameType
cleanUsercleanUser
emailstring
passwordany
usernamestring

Returns: Promise‹string›


findPasswordHash

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

Defined in mongo.ts:144

Parameters:

NameType
userIdstring

Returns: Promise‹string | null›


findSessionById

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

Defined in mongo.ts:416

Parameters:

NameType
sessionIdstring

Returns: Promise‹Session | null›


findSessionByToken

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

Defined in mongo.ts:408

Parameters:

NameType
tokenstring

Returns: Promise‹Session | null›


findUserByEmail

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

Defined in mongo.ts:121

Parameters:

NameType
emailstring

Returns: Promise‹User | null›


findUserByEmailVerificationToken

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

Defined in mongo.ts:152

Parameters:

NameType
tokenstring

Returns: Promise‹User | null›


findUserById

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

Defined in mongo.ts:112

Parameters:

NameType
userIdstring

Returns: Promise‹User | null›


findUserByResetPasswordToken

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

Defined in mongo.ts:162

Parameters:

NameType
tokenstring

Returns: Promise‹User | null›


findUserByServiceId

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

Defined in mongo.ts:172

Parameters:

NameType
serviceNamestring
serviceIdstring

Returns: Promise‹User | null›


findUserByUsername

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

Defined in mongo.ts:131

Parameters:

NameType
usernamestring

Returns: Promise‹User | null›


invalidateAllSessions

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

Defined in mongo.ts:371

Parameters:

NameType
userIdstring
excludedSessionIds?string[]

Returns: Promise‹void›


invalidateSession

invalidateSession(sessionId: string): Promise‹void›

Defined in mongo.ts:358

Parameters:

NameType
sessionIdstring

Returns: Promise‹void›


removeAllResetPasswordTokens

removeAllResetPasswordTokens(userId: string): Promise‹void›

Defined in mongo.ts:396

Parameters:

NameType
userIdstring

Returns: Promise‹void›


removeEmail

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

Defined in mongo.ts:203

Parameters:

NameType
userIdstring
emailstring

Returns: Promise‹void›


setPassword

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

Defined in mongo.ts:252

Parameters:

NameType
userIdstring
newPasswordstring

Returns: Promise‹void›


setResetPassword

setResetPassword(userId: string, email: string, newPassword: string): Promise‹void›

Defined in mongo.ts:467

Parameters:

NameType
userIdstring
emailstring
newPasswordstring

Returns: Promise‹void›


setService

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

Defined in mongo.ts:271

Parameters:

NameType
userIdstring
serviceNamestring
serviceobject

Returns: Promise‹void›


setUserDeactivated

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

Defined in mongo.ts:299

Parameters:

NameType
userIdstring
deactivatedboolean

Returns: Promise‹void›


setUsername

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

Defined in mongo.ts:236

Parameters:

NameType
userIdstring
newUsernamestring

Returns: Promise‹void›


setupIndexes

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

Defined in mongo.ts:57

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:284

Parameters:

NameType
userIdstring
serviceNamestring

Returns: Promise‹void›


updateSession

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

Defined in mongo.ts:337

Parameters:

NameType
sessionIdstring
connectionConnectionInformations
newToken?string

Returns: Promise‹void›


verifyEmail

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

Defined in mongo.ts:219

Parameters:

NameType
userIdstring
emailstring

Returns: Promise‹void›