Interface
Versionsโ
Curerrent unified version:
| Version | Date | Changes |
|---|---|---|
| 01-06-2025 | Initial Release |
Fieldsโ
This is database specific and thus will be different for each database.
Functionsโ
| Function | Description | Parameters |
|---|---|---|
| dbCreatre | Creates new documents in the database | client, dbName, colName, data |
| dbRead | Reads documents from the database | client, dbName, colName, query, pln |
| dbUpdate | Updates documents in the database | client, dbName, colName, query, data |
| dbDelete | Deletes documents from the database | client, dbName, colName, query |
| dbCon | Connects to the database | client |
| dbCls | Closes the connection to the database | client |
| dbAuth | Authenticates the user | uri |
Function parametersโ
| Parameter | Type | Description |
|---|---|---|
client | MongoClient | The client to connect to the database |
dbName | string | The name of the database |
colName | string | The name of the collection |
data | any | The data to be inserted |
query | any | The query to be used |
pln | any | The pipeline to be used |
uri | string | The 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]