3.2.0 • Published 4 months ago

@parameter1/mongodb-core v3.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

MongoDB Core

A MongoDB wrapper containing core utilities.

Installation

yarn add @parameter1/mongodb-core

Usage

Core

import { MongoClient } from '@parameter1/mongodb-core';

const client = new MongoClient('mongodb://some-server:27071');

client.connect().then(() => console.log('connected'));

Utilities

import { filterMongoURL, iterateMongoCursor, MongoClient } from '@parameter1/mongodb-core';

// strips user names and passwords from mongo URLs
const client = new MongoClient('mongodb://user:password@some-server:27071');
// logs `mongodb://*****:*****@some-server:27071`
console.log(filterMongoURL(client));


// iterates over a mongo cursor
const cursor = await client.db('test').collection('foo').findMany({});

await iterateMongoCursor(cursor, async (doc) => {
  // do things here... can await
  await someThing(doc);
});
3.2.0

4 months ago

3.1.0

7 months ago

3.0.0

8 months ago

2.3.0

9 months ago

2.2.0

11 months ago

2.1.0

1 year ago

1.4.0

1 year ago

2.0.0

1 year ago

1.2.0

1 year ago

1.3.0

1 year ago

1.1.0

1 year ago

1.0.0

2 years ago