@hauslo/util-mongo-client
v0.1.3
Published
See the [example](./example/index.js)
Downloads
1
Readme
@hauslo/util-monog-client
See the example
const Log = require("debug");
const startMongoClient = require("@hauslo/util-monog-client");
const NAMESPACE = "demo";
const log = Log(`${NAMESPACE}:test`);
Log.enable(`${NAMESPACE}*`);
const url = "mongodb://localhost:27017";
const { getClient: getMongoClient, stop: stopMongoClient } = startMongoClient({
config: { url },
log,
});
(async () => {
const client = await getMongoClient().catch((err) => log(err));
await stopMongoClient();
})();