1.0.1 • Published 1 year ago
mongodb-serverless v1.0.1
mongodb-serverless
Create MongoDB driver instances optimized for serverless environments.
Instances are cached between requests to minimize the number of connections and improve performance.
Installation
npm install mongodb-serverless
Usage
import { getMongoClient } from "mongodb-serverless";
export async function handler(event) {
const client = getMongoClient(process.env.MONGO_URI, { appName: "app" });
return await client.db().collection("docs").find({}).toArray();
}