Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

changestream-iterator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

changestream-iterator

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

  • 0.1.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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);

}

FAQs

Package last updated on 21 Mar 2021

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc