Collection
The data is stored in collections, where how the collection is created and its detailed information are specified.
new Collection(options)
new Collection(options)
Create a collection where you can manage and store your data.
Parameter | Default | Description |
---|---|---|
options | Object Collection options. | |
options.name | String Name of collection. | |
options.type | String
[IMPORTANT] Type of the collection, which cannot be changed again later.
Valid values: | |
options.id_length |
| Number (optional) [DOCUMENT-BASED COLLECTIONS] This determines the length of unique identities given to documents. |
options.indicate_created_at |
| Boolean (optional) [DOCUMENT-BASED COLLECTIONS] Whether to specify the creation date of documents. |
options.indicate_created_timestamp |
| Boolean (optional) [DOCUMENT-BASED COLLECTIONS] Whether to specify the creation timestamp of documents. |
options.indicate_edited_at |
| Boolean (optional) [DOCUMENT-BASED COLLECTIONS] Whether to specify the edited date of documents. |
options.indicate_edited_timestamp |
| Boolean (optional) [DOCUMENT-BASED COLLECTIONS] Whether to specify the edited timestamp of documents. |
options.indicate_archived_at |
| Boolean (optional) [DOCUMENT-BASED COLLECTIONS] Whether to specify the archived at of documents. |
options.indicate_archived_timestamp |
| Boolean (optional) [DOCUMENT-BASED COLLECTIONS] Whether to specify the archived timestamp of documents. |
options.indicate_unarchived_at |
| Boolean (optional) [DOCUMENT-BASED COLLECTIONS] Whether to specify the unarchived at of documents. |
options.indicate_unarchived_timestamp |
| Boolean (optional) [DOCUMENT-BASED COLLECTIONS] Whether to specify the unarchived timestamp of documents. |
options.save_timeout |
| Number (optional)
This specifies how many seconds after a document is inserted, the collection will be saved. This way it limits the successive saving of the collection when many data are inserted in succession, so the system is not slowed down. Data loss may occur if the system is turned off after repeatedly entering data. When the document is added 5 times in a row, the collection is saved so that the data does not remain unsaved for a long time. This can be edited with the |
options.save_directly_after |
| Number (optional) This specifies that after how many documents have been inserted, the collection will be saved without the save timeout. |
options.cache_retention_time |
| Number (optional)
[If this value is |
options.backup_retention_time |
| Number (optional)
[If this value is |
options.caching |
| Boolean (optional) [IMPORTANT] If this is enabled, the data is kept in the cache. In this case, the data is processed quickly, but the size of the collection is the loss of RAM. Is not preferred for large collections. |
options.auto_create_backup |
| Boolean (optional) If this is enabled, this collection will create automatic backups. |
options.detailed_debugger_logs |
| Boolean (optional) If this is enabled, it will print more events in the collection to the console. |
options.activate_drop_method |
| Boolean (optional)
[IMPORTANT] If this is enabled, the |
Example:
Last updated