Skip to main content

Interface

Versionsโ€‹

Curerrent unified version: unified version

VersionDateChanges
unified version01-06-2025Initial Release

Fieldsโ€‹

This is database specific and thus will be different for each database.

Functionsโ€‹

FunctionDescriptionParameters
dbCreatreCreates new documents in the databaseclient, dbName, colName, data
dbReadReads documents from the databaseclient, dbName, colName, query, pln
dbUpdateUpdates documents in the databaseclient, dbName, colName, query, data
dbDeleteDeletes documents from the databaseclient, dbName, colName, query
dbConConnects to the databaseclient
dbClsCloses the connection to the databaseclient
dbAuthAuthenticates the useruri

Function parametersโ€‹

ParameterTypeDescription
clientMongoClientThe client to connect to the database
dbNamestringThe name of the database
colNamestringThe name of the collection
dataanyThe data to be inserted
queryanyThe query to be used
plnanyThe pipeline to be used
uristringThe uri to connect to the database (database specific)

All functions return the following:

  • response: The response of the function which contains status and data an example can be seen below

If the function is successful, it returns the following:

{
"status": "success",
"data": {
// data
}
}

If the function fails, it returns the following:

{
"status": "error",
"error": "error message"
}

TS interfaceโ€‹

export interface funcResponse<T = any> {
status: 'OK' | 'ERROR';
data?: T;
error?: string;
}

export const authFields = [
'uri'
] as const

export type authFields = typeof authFields[number]