@bricco/mongo-wrapper v1.2.5
@bricco/mongo-wrapper
A simple wrapper to get a unified interface against the MongoDB Data API and MongoDB Node Driver
The wrapper is very useful if you want to use MongoDB in Vercel Edge Runtime or benifit from the Nextjs built-in data cache. But still have the possibilty do run tests against an In-Memory Storage Engine or use a local database with the native Node Driver.
Install
The usual ways:
yarn add @bricco/mongo-wrapper
Example
import createDb from '@bricco/mongo-wrapper'
const db = createDb({
apiKey: 'XXXXXXXX',
apiUrl: 'https://data.mongodb-api.com/app/data-abc123/endpoint/data/v1',
dataSource: 'myCluser',
database: 'myDatabase',
connectionString: 'mongodb+srv://user:<PWD>@myCluser.apc123.mongodb.net',
})
const car = await db('mycollection').findOne({ type: 'car' })
// => { _id: "61df...", type: "car", ...etc }
const useNodeDriver = true;
const bike = await db('mycollection', useNodeDriver).findOne({ type: 'bike' })
// => { _id: "61df...", type: "bike", ...etc }
8 days ago
21 days ago
22 days ago
22 days ago
22 days ago
22 days ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago