Socket
Book a DemoInstallSign in
Socket

@bricco/mongo-wrapper

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bricco/mongo-wrapper

A wrapper for mongodb with a unified interface against the data API / node driver.

2.0.1
latest
Source
npmnpm
Version published
Weekly downloads
124
-49.39%
Maintainers
2
Weekly downloads
 
Created
Source

@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';
import { unstable_cache as cache } from 'next/cache';

const db = createDb({
	database: 'myDatabase',
	connectionString: 'mongodb+srv://user:<PWD>@myCluser.apc123.mongodb.net',
	cache: cache,
})

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 }

FAQs

Package last updated on 27 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.