mongodb-serverless
v1.0.1
Published
Create MongoDB driver instances optimized for serverless environments
Downloads
8
Readme
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();
}