0.1.6 • Published 3 years ago

changestream-iterator v0.1.6

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

ChangeStreamIterator

Super simple wrapper around Mongoose Change Streams to produce an ES6 AsyncIterator that will wait for events.

This allows you to use the iterator standalone in any supported environment, or pass to Apollo as the subscriber method of a Subscription resolver to create realtime graphql subscriptions for your MongoDB documents.

import { ChangeStreamIterator } from 'changestream-iterator';
import db from './db';


const userChangeIterator = db.collection('users').watch(undefined, { fullDocument: 'updateLookup' });
const changeStream = new ChangeStreamIterator([userChangeIterator]);


for await (const event of changeStream) {
    console.log('CHANGE:', event);

}
0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.2

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago