Skip to content

ArthurKa/mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();
})();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published