Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

micro-toolkit-event-storage-mongo

1.1.0 • Public • Published

Build Status

Micro-toolkit Event Storage MongoDB

A mongodb implementation of the event storage interface.

Install

$ npm install micro-toolkit-event-storage-mongo --save

Usage

var factory = require('micro-toolkit-event-storage-mongo')
 
var instance = factory.getInstance('mongodb://localhost/event_sample')
 
var promises = [
  // receives the sequence number and the raw data
  // and returns a promise
  instance.insert(1, { id: 100, something: true }),
  instance.insert(2, { id: 101, something: true }),
  instance.insert(3, { id: 102, something: true }),
  instance.insert(4, { id: 103, something: true }),
  instance.insert(5, { id: 104, something: true })
]
 
Promise.all(promises)
  .then(function () {
    return instance.get(0)
  })
  .then(console.log)
  .then(function () {
    return instance.get(1)
  })
  .then(console.log)
  .then(function () {
    return instance.get(4)
  })
  .then(console.log)
  .then(function () {
    return instance.get(5)
  })
  .then(console.log)
  .then(function () {
    return instance.lastSequence()
  })
  .then(console.log)

install

npm i micro-toolkit-event-storage-mongo

Downloadsweekly downloads

16

version

1.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability