Gets or creates a MongoDB client connection to the Hub database.
This function implements a singleton pattern to ensure only one client connection is maintained throughout the application lifecycle. The connection is lazily initialized on first use.
Promise resolving to the MongoDB client instance
const client = await getHubClient();const db = client.db('data');const collection = db.collection('message'); Copy
const client = await getHubClient();const db = client.db('data');const collection = db.collection('message');
Gets or creates a MongoDB client connection to the Hub database.
This function implements a singleton pattern to ensure only one client connection is maintained throughout the application lifecycle. The connection is lazily initialized on first use.