node-grau
v1.0.21
Published
A framework for MongoDB Atlas dedicated to Discord bot development. Used by Nefomemes/Kylebot for database purposes.
Downloads
6
Maintainers
Readme
>mongodb<.Collection()
- Methods added
- getDoc()
Get a document that matches the query given. If none matches, a document that matches the query given will be created. Returns Promise<Object>.
----------------------------------------------------------------------------------------------------------
| Parameter | Optional | Default | Type | Description |
| ---------------- | -------- | ------- | -------------------------- | --------------------------------- |
| query | false | null | Anything | The object you want to match with |
| | | | | the documents. |
----------------------------------------------------------------------------------------------------------
- updateDoc()
Update a document that matches the query given. If none matches, a document that matches the query given will be created and that document will be the one edited. Returns Promise<Object>.
---------------------------------------------------------------------------------------------------------
| Parameter | Optional | Default | Type | Description |
| --------------- | -------- | ------- | -------------------------- | --------------------------------- |
| query | false | null | Anything | The object you want to match with |
| | | | | the documents. |
| --------------- | -------- | ------- | -------------------------- | ----------------------------------|
| operation | false | null | Object | Regular MongoDB operators object |
| | | | | you use. |
---------------------------------------------------------------------------------------------------------
- giveItem()
Add an item to a property of a document that matches the query given. If none matches, a document that matches the query given will be created and that document will be the one edited. If the property already have the item, it wont receive the item or will receive an increment in their currency property. Returns Promise<Object>.
---------------------------------------------------------------------------------------------------------
| Parameter | Optional | Default | Type | Description |
| --------------- | -------- | ------- | -------------------------- | --------------------------------- |
| query | false | null | Anything | The object you want to match with |
| | | | | the documents. |
| --------------- | -------- | ------- | -------------------------- | --------------------------------- |
| property | false | null | Anything | The name of the property you want |
| | | | | the item to be given to. |
| --------------- | -------- | ------- | -------------------------- | --------------------------------- |
| item | false | null | Anything | The item you want to add to the |
| | | | | property. |
| --------------- | -------- | ------- | -------------------------- | --------------------------------- |
| economySettings | true | {} | Object | The settings for the economy |
| | | | | increment thing. |
| --------------- | -------- | ------- | -------------------------- | --------------------------------- |
| economySettings | false | null | Object | The property you want to |
| .property | | | | increment. Rules in MongoDB |
| | | | | Operators applies. |
| --------------- | -------- | ------- | -------------------------- | --------------------------------- |
| economySettings | false | null | Number | How much the value you want to be |
| .money | | | | incremented with. |
---------------------------------------------------------------------------------------------------------