Skip to main content

db

This class provides methods to interact with the database. Used for performing operations like creating, updating, deleting, and querying documents.

Methods​

db.getCollection()​

Returns a collection from the database.

caution

This function can only be used with MongoDB databases.

Parameters​

ParameterTypeRequiredDescription
collectionstringβœ…The name of the collection to get.

Returns Collection - MongoDB Collection​


db.createOne()​

Creates a new document in the database.

caution

ALL query properties are required here.

Parameters​

ParameterTypeRequiredDescription
queryUserOptions LevelRoleOptionsβœ…The options for user or level role.

Returns Promise<UserResult | LevelRoleResult> - User or Level Role​


db.deleteMany()​

Deletes multiple documents from the database.

Parameters​

ParameterTypeRequiredDescription
queryUserOptions LevelRoleOptionsβœ…The options for user or level role.

db.deleteOne()​

Deletes a document from the database.

Parameters​

ParameterTypeRequiredDescription
queryUserOptions LevelRoleOptionsβœ…The options for user or level role.

Returns Promise<UserResult | LevelRoleResult> - User or Level Role​


db.findOne()​

Finds a document from the database.

Parameters​

ParameterTypeRequiredDescription
queryUserOptions LevelRoleOptionsβœ…The options for user or level role.

Returns Promise<UserResult | LevelRoleResult> - User or Level Role​


db.find()​

Finds documents from the database.

Parameters​

ParameterTypeRequiredDescription
collectionsimply-xps
simply-xp-levelroles
βœ…The name of the collection to get.
guildIdstringβœ…The guild ID.

Returns Promise< UserResult[] | LevelRoleResult[] > - User or Level Role​


db.findAll()​

Finds all documents from the database.

Parameters​

ParameterTypeRequiredDescription
collectionsimply-xps
simply-xp-levelroles
βœ…The name of the collection to get.

Returns Promise< UserResult[] | LevelRoleResult[] > - User or Level Role​


db.updateOne()​

Updates a document in the database.

Parameters​

ParameterTypeRequiredDescription
filterUserOptions LevelRoleOptionsβœ…The options for user or level role.
updateUserOptions LevelRoleOptionsβœ…The update to apply to the document.
optionsUpdateOneOptions❌The options for the update. (MONGODB)

Returns Promise<UserResult | LevelRoleResult> - User or Level Role​