MCPcopy Create free account
hub / github.com/dev-mastery/comments-api / makeDb

Function makeDb

__test__/fixtures/db.js:6–15  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4let connection, db
5
6export default async function makeDb () {
7 connection =
8 connection ||
9 (await MongoClient.connect(
10 global.__MONGO_URI__,
11 { useNewUrlParser: true }
12 ))
13 db = db || (await connection.db(global.__MONGO_DB_NAME__))
14 return db
15}
16
17export async function closeDb () {
18 await connection.close()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected