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β
Parameter | Type | Required | Description |
---|---|---|---|
collection | string | β | 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β
Parameter | Type | Required | Description |
---|---|---|---|
query | UserOptions 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β
Parameter | Type | Required | Description |
---|---|---|---|
query | UserOptions LevelRoleOptions | β | The options for user or level role. |
db.deleteOne()
β
Deletes a document from the database.
Parametersβ
Parameter | Type | Required | Description |
---|---|---|---|
query | UserOptions 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β
Parameter | Type | Required | Description |
---|---|---|---|
query | UserOptions LevelRoleOptions | β | The options for user or level role. |
Returns Promise<UserResult
| LevelRoleResult
> - User or Level Roleβ
db.find()
β
Finds documents from the database.
Parametersβ
Parameter | Type | Required | Description |
---|---|---|---|
collection | simply-xps simply-xp-levelroles | β | The name of the collection to get. |
guildId | string | β | The guild ID. |
Returns Promise< UserResult
[]
| LevelRoleResult
[]
> - User or Level Roleβ
db.findAll()
β
Finds all documents from the database.
Parametersβ
Parameter | Type | Required | Description |
---|---|---|---|
collection | simply-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β
Parameter | Type | Required | Description |
---|---|---|---|
filter | UserOptions LevelRoleOptions | β | The options for user or level role. |
update | UserOptions LevelRoleOptions | β | The update to apply to the document. |
options | UpdateOneOptions | β | The options for the update. (MONGODB) |