Database

Represents the main database.

Properties

Property

Description

collections

Array<Collection>

Array of the collections from the database

version

String

The current version of the package

Constructor

new Database(config)

Parameter

Default

Description

config

Object (optional)

The configuration to use in the database

config.autoSave

true

Boolean (optional)

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

config.collectionsFolder

'./collections'

String (optional)

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

config.collectionTimestamps

false

Boolean (optional)

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

config.dataFile

'./database.json'

String (optional)

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

config.encryptionKey

null

String (optional)

The Encryption Key to use in encryption and decryption

config.tabSize

0

Number (optional)

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

Last updated