Collection

The data is stored in collections, where how the collection is created and its detailed information are specified.

new Collection(options)

Create a collection where you can manage and store your data.

Parameter
Default
Description

options

options.name

options.type

options.id_length

32

options.indicate_created_at

false

options.indicate_created_timestamp

false

options.indicate_edited_at

false

options.indicate_edited_timestamp

false

options.indicate_archived_at

false

options.indicate_archived_timestamp

false

options.indicate_unarchived_at

false

options.indicate_unarchived_timestamp

false

options.save_timeout

1

options.save_directly_after

5

options.cache_retention_time

10

options.backup_retention_time

3

options.caching

false

options.auto_create_backup

false

options.detailed_debugger_logs

false

options.activate_drop_method

false

Example:

const example_collection = new <PeakDB | Connection>.Collection({
  "name": "EXAMPLE_COLLECTION",
  "type": "DOCUMENT_BASED",
  
  /*
    For document based collections
  */
  "id_length": 32,
  "indicate_created_at": false,
  "indicate_created_timestamp": true,
  "indicate_updated_at": false,
  "indicate_updated_timestamp": true,
  "indicate_archived_at": false,
  "indicate_archived_timestamp": true,
  "indicate_unarchived_at": false,
  "indicate_unarchived_timestamp": true,
  
  /*
    Can be used on all collection types
  */
  "save_timeout": 1,
  "save_directly_after": 5,
  "cache_retention_time": 10,
  "backup_retention_time": 3,
  "caching": true,
  "auto_create_backup": true,
  "detailed_debugger_logs": true,
  "activate_drop_method": false
});

Last updated