Skip to main content

Modal

The primary interaction point for handing schemas and documents.

info

See examples/databasing for getting started with databasing.

Constructor​

new Modal(name, schema, scoreboardName);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
namestring❌undefinedName of model (used to reference serialized data for fetching).
schemaSchema❌undefinedBlueprint for modal.
scoreboardNamestring?✔️BeAPI__DATABASEName of scoreboard documents for this modal should go under.

Properties​

schema READONLY​

Parent schema blueprint.

Type: Schema


name READONLY​

Schema name used to categorize documents.

Type: Schema


scoreboardName READONLY​

Scoreboard name in which schema saves documents to.

Type: Schema


Methods​

asArray​

Return all documents as an array.

asArray();

Returns​

Document[]


find​

Uses partial data provided to find a specific document.

find(partial);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
partialobject❌undefinedPartial data matcher.

Returns​

Document | undefined


findAll​

Uses partial data provided to find a all matching documents.

findAll(partial);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
partialobject❌undefinedPartial data matcher.

Returns​

Document[]


write​

Write a new document to be stored.

write(data);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
dataobject❌undefinedData to be stored.

Returns​

Document


writeBulk​

Write a new document to be stored.

write(data);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
dataobject[]❌undefinedDatas to be stored.

Returns​

Document[]


delete​

Deletes documents from database.

delete(id);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idstring❌undefinedDocument to delete.

Returns​

void


deleteAll​

Deletes all documents from database.

warning

This is pretty dangerous and irreversible... Be careful!

deleteAll(data);

Returns​

void


sync​

Syncs document with persistent storage.

sync(id);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
idstring❌undefinedDocument to sync.

Returns​

void