# changestream-iterator

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

Latest version **0.1.6** (published 2021-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install changestream-iterator
pnpm add changestream-iterator
yarn add changestream-iterator
bun add changestream-iterator
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2021-03-21 |
| First published | 2021-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Luke Smetham |
| Maintainers | lukesmetham |

## Links

- npm: https://www.npmjs.com/package/changestream-iterator
- Repository: https://github.com/LukeSmetham/changestream-iterator
- npm.io page: https://npm.io/package/changestream-iterator

## Recent versions

- 0.1.6 (latest) — 2021-03-21
- 0.1.5 — 2021-03-21
- 0.1.4 — 2021-01-13
- 0.1.3 — 2021-01-12
- 0.1.2 — 2021-01-12
- 0.1.1 — 2021-01-12

## README

# 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.


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

}
```

---
_Source: https://npm.io/package/changestream-iterator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
