Skip to content
On this page

Athena.database.singleton

Functions

create

Usage

Athena.database.singleton.create<T>(collection, data): Promise<{ _id: string } & T>

Creates a single document to be stored in a collection.

Only one document may ever exist for a collection.

Returns the existing singleton if already present.

Export

Type parameters

NameType
T{}

Parameters

NameType
collectionstring
dataT

Returns

Promise<{ _id: string } & T>

Defined in

server/database/singleton.ts:28


get

Usage

Athena.database.singleton.get<T>(collection): Promise<{ _id: string } & T>

Returns a singleton document if it exists.

Export

Type parameters

NameType
T{}

Parameters

NameType
collectionstring

Returns

Promise<{ _id: string } & T>

Defined in

server/database/singleton.ts:11


updateBulk

Usage

Athena.database.singleton.updateBulk<T>(collection, data): Promise<boolean>

Update all the data from a single document in a collection.

Only one document may ever exist for a collection.

This takes the data from the database and applies your data on top of it.

Returns true if updated successfully

Export

Type parameters

NameType
T{}

Parameters

NameType
collectionstring
dataPartial<T>

Returns

Promise<boolean>

Defined in

server/database/singleton.ts:77


updateField

Usage

Athena.database.singleton.updateField(collection, fieldName, fieldValue): Promise<boolean>

Update / insert a single document into a collection.

Only one document may ever exist for a collection.

Export

Parameters

NameType
collectionstring
fieldNamestring
fieldValueany

Returns

Promise<boolean>

Defined in

server/database/singleton.ts:53

Created by Stuyk | Est. 2020