@xdapps/mongodb-utils
v1.0.1
Published
Basic wrapper around MongoDb SDK to simplify common operations
Downloads
19
Readme
MongoDB Utils
This is a basic wrapper around the MongoDB SDK with some simple static functions to interact with a Mongo Database.
Basics
- Create a MongoDB either locally or in the cloud.
- 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: "[email protected]"};
const docResult = await db.getSingleDocFromDb(collectionName, searchCriteria);