Database

Represents the main database.

Properties

Property

Description

collections

Arrayarrow-up-right<Collection>

Array of the collections from the database

version

Stringarrow-up-right

The current version of the package

Constructor

new Database(config)

Parameter

Default

Description

config

Objectarrow-up-right (optional)

The configuration to use in the database

config.autoSave

true

Booleanarrow-up-right (optional)

Whether or not to write data into the JSON file everytime it is updated

config.collectionsFolder

'./collections'

Stringarrow-up-right (optional)

The path to a folder where collections' data will be stored

config.collectionTimestamps

false

Booleanarrow-up-right (optional)

Whether or not to automatically add the createdAt and updatedAt attributes to every collection entry

config.dataFile

'./database.json'

Stringarrow-up-right (optional)

The path to the JSON file (from the root of the project) where the main data will be stored

config.encryptionKey

null

Stringarrow-up-right (optional)

The Encryption Key to use in encryption and decryption

config.tabSize

0

Numberarrow-up-right (optional)

The size of the tab in the JSON file (indentation)

Last updated