mongoose-querystream-worker
Execute an async function per document in a streamed query, pausing the stream when a concurrency limit is saturated
Last updated 4 years ago by sylspren .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mongoose-querystream-worker 
SYNC missed versions from official npm registry.

mongoose-querystream-worker build status

Execute an async function per document in a streamed query, pausing the stream when a concurrency limit is saturated. Think async.queue but for Mongoose QueryStreams. Built on top of stream-worker.

require('mongoose-querystream-worker');

/* Promises: */

Model.find().stream().concurrency(n).work(function (doc) {
  /* ... work with the doc ... */ 
  return doc.save(); /* returns a promise */
})
.then(function() {
  /* ...  all workers have finished ... */
}, function(err) {
  /* ...  something went wrong ... */
});

/* Callbacks: */

Model.find().stream().concurrency(n).work(
  function (doc, done) {
    /* ... work with the doc ... */
  },
  function (err) {
    /* ...  all workers have finished ... */
  }
);

Current Tags

  • 3.0.1                                ...           latest (4 years ago)

7 Versions

  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
  • 0.0.0                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 1
Dependencies (2)
Dev Dependencies (2)

Copyright 2014 - 2017 © taobao.org |