@arthurka/mongodb
TypeScript icon, indicating that this package has built-in type declarations

2.2.1 • Public • Published

tsconfig.json

{
  "include": [
    "node_modules/@arthurka/mongodb/build/modules.d.ts",
  ],
  "exclude": [
    // no "node_modules",
  ],
}

.env

MONGO_URL = mongodb://localhost:27017/<DB_NAME>

Or

MONGO_URL = mongodb://localhost:27017
DB_NAME = <DB_NAME>

Usage

import { getDBCollection, closeDB } from '@arthurka/mongodb';

(async () => {
  const collection = await getDBCollection('collection');

  await closeDB();
})();

Or

import { getDBCollection, closeDB } from '@arthurka/mongodb';

interface Document {
  name: string;
  age: number;
}

(async () => {
  const collection = await getDBCollection<Document>('collection');

  await closeDB();
})();

Readme

Keywords

none

Package Sidebar

Install

npm i @arthurka/mongodb

Weekly Downloads

2

Version

2.2.1

License

ISC

Unpacked Size

6.23 kB

Total Files

5

Last publish

Collaborators

  • arthurka