1.0.0-beta.1 • Published 7 years ago

geyser-mongo v1.0.0-beta.1

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

Build Status Codecov NPM version Standard Version dependencies Status devDependencies Status

Geyser

Publish and subscribe to streams of data over MongoDB.

Usage

Source Node.js process:

import { Observable } from 'rxjs';
import { MongoObserver } from 'geyser-mongo';

// Create an Observer which writes to a 'ticks' collection in MongoDB
const ticks = MongoObserver.connect({
  url: 'mongodb://localhost/my-db',
  collection: 'ticks'
})

// Subscribe our "ticks" observer to a stream
Observable.interval(1000).subscribe(ticks);

Listening Node.js process:

import { MongoObservable } from 'geyser-mongo';

// create a 
const ticks = MongoObservable.connect({
  url: 'mongodb://localhost/my-db',
  collection: 'ticks'
})

// Subscribe to the "ticks" stream
ticks.subscribe(console.log);

// 1
// 2
// 3
// ...