@geekson/mongodb-connector
v2.1.0
Published
A simple, yet useful, mongodb connector.
Downloads
46
Readme
mongodb-connector
A simple, yet useful, mongoDB connector.
Install
npm install @geekson/mongodb-connector
Usage
Ensure to have a .env
file with the following properties:
MONGODB_URI
: the URI to connect to
MONGODB_DB
: the database to connect to
import { connectToDatabase } from '@geekson/mongodb-connector';
async getAllPosts() {
const { db } = await connectToDatabase();
return await db.collection('Post').find().toArray();
}
Changelog
2021-12-04
Updated version of underlying library (mongodb).
Please refer to this page for instructions (many changes).