> For the complete documentation index, see [llms.txt](https://simpldb.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simpldb.js.org/v2.11.0/documentation/database.md).

# Database

Represents the main database.

### Properties

| **Property** | **Description**                                                                                                                                                                                                                   |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| collections  | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a><<a href="/v2.11.0/documentation/collection.md">Collection</a>></p><p>Array of the collections from the database</p> |
| version      | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></p><p>The current version of the package</p>                                                                      |

### Constructor

#### new Database(config)

| **Parameter**               |     **Default**     | **Description**                                                                                                                                                                                                                             |
| --------------------------- | :-----------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| config                      |                     | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a> (optional)</p><p>The configuration to use in the database</p>                                                               |
| config.autoSave             |        `true`       | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a> (optional)</p><p>Whether or not to write data into the JSON file everytime it is updated</p>                              |
| config.collectionsFolder    |  `'./collections'`  | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> (optional)</p><p>The path to a folder where collections' data will be stored</p>                                            |
| config.collectionTimestamps |       `false`       | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a> (optional)</p><p>Whether or not to automatically add the createdAt and updatedAt attributes to every collection entry</p> |
| config.dataFile             | `'./database.json'` | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> (optional)</p><p>The path to the JSON file (from the root of the project) where the main data will be stored</p>            |
| config.encryptionKey        |        `null`       | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a> (optional)</p><p>The Encryption Key to use in encryption and decryption</p>                                                 |
| config.tabSize              |         `0`         | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a> (optional)</p><p>The size of the tab in the JSON file (indentation)</p>                                                     |
