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

1.0.1 • Public • Published

MongoDB Utils

This is a basic wrapper around the MongoDB SDK with some simple static functions to interact with a Mongo Database.

Basics

  1. Create a MongoDB either locally or in the cloud.
  2. Create a .env file and set your MongoDB connection string.
MONGO_DB_CONNECTION_STRING=mongodb://localhost:27017

How To Use

import {MongoDB} from "@xdapps/mongodb-utils"

const db = new MongoDB("database_name");
const collectionName = "users";
const searchCriteria = {email: "johnDoe@gmail.com"};
const docResult = await db.getSingleDocFromDb(collectionName, searchCriteria);

Readme

Keywords

none

Package Sidebar

Install

npm i @xdapps/mongodb-utils

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

5.31 kB

Total Files

7

Last publish

Collaborators

  • xdapps