1.2.5 • Published 8 days ago

@bricco/mongo-wrapper v1.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
8 days ago

@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 }
1.2.5

8 days ago

1.2.4

21 days ago

1.2.0

22 days ago

1.2.3

22 days ago

1.2.2

22 days ago

1.2.1

22 days ago

1.1.1

3 months ago

1.1.3

3 months ago

1.1.2

3 months ago

1.1.0

3 months ago

1.0.29

3 months ago

1.0.28

3 months ago

1.0.26

3 months ago

1.0.27

3 months ago

1.0.22

3 months ago

1.0.21

3 months ago

1.0.25

3 months ago

1.0.24

3 months ago

1.0.23

3 months ago

1.0.20

4 months ago

1.0.19

4 months ago

1.0.18

4 months ago

1.0.17

4 months ago

1.0.16

4 months ago

1.0.15

4 months ago

1.0.14

5 months ago

1.0.13

5 months ago

1.0.9

6 months ago

1.0.11

6 months ago

1.0.10

6 months ago

1.0.12

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago