DAILY DOCDAILY DOC
Rust
Node
Notes
Ubuntu
Leetcode
  • it-tools
  • excalidraw
  • linux-command
Rust
Node
Notes
Ubuntu
Leetcode
  • it-tools
  • excalidraw
  • linux-command
  • node

    • NODE
    • parseArgs
    • compose
    • date-format
    • dayjs
    • encrypt
    • env-cmd
    • glob
    • Koa 洋葱模型
    • lodash
    • logger
    • log4js
    • mongod
    • nanoid
    • node-red
    • node-stream
    • node:test
    • nodemailer
    • nodemon
    • nodered
    • parse-curl
    • pm2
    • toml
    • ws
    • yargs
    • zx

mongod

npm i mongodb
let $db = null;

if (config.host) {
  const client = new MongoClient(config.host, config.auth);
  try {
    await client.connect();
    $db = client.db('xxx');
  } catch (error) {
    logger.error('mongo error', error);
  }
}

export default $db;

Refer

  • npm mongod
  • mongodb-vscode
Last Updated:
Contributors: rosendo
Prev
log4js
Next
nanoid