1.0.1 • Published 1 year ago

mongodb-serverless v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

npm verison npm bundle size npm downloads

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();
}
1.0.1

1 year ago

1.0.0

1 year ago