Skip to content

Commit eaac960

Browse files
📝 Add docstrings to database-models
Docstrings generation was requested by @ailearningguy. * #3 (comment) The following files were modified: * `lib/mongodb.ts`
1 parent 6569e17 commit eaac960

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎lib/mongodb.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ if (!cached) {
3333
};
3434
}
3535

36+
/**
37+
* Get or establish a cached Mongoose connection to the configured MongoDB URI.
38+
*
39+
* Reuses an existing cached connection when available; otherwise establishes a new connection and caches it for subsequent calls.
40+
*
41+
* @returns The established Mongoose connection
42+
*/
3643
async function connectDB() {
3744
// If a connection is already cached, use it
3845
if (cached.conn) {
@@ -52,4 +59,4 @@ async function connectDB() {
5259
return cached.conn;
5360
}
5461

55-
export default connectDB;
62+
export default connectDB;

0 commit comments

Comments
 (0)