Publications using aggregation framework based on change streams


#1

Hello, guys! I am happy to say that my the very first public meteor package is completed, I think you might want to use it.

You can read about it here:
https://atmospherejs.com/kschingiz/publish-change-streams

meteor-publish-change-streams

This package allows you to reactively subscribe and publish mongo change streams.

It will NOT send you data on first subscribe like other subscribes does, it’s going to send you data ONLY when docs matching your pipeline changes (created, updated or deleted).

why do we need this

  1. Reailtime aggregations!!

From MongoDB doc:
Change streams allow applications to access real-time data changes without the complexity and risk of tailing the oplog. Applications can use change streams to subscribe to all data changes on a single collection, a database, or an entire deployment, and immediately react to them. Because change streams use the aggregation framework, applications can also filter for specific changes or transform the notifications at will.
requirements

Meteor 1.7+
Mongo 3.6+

API

You can read about change streams here https://docs.mongodb.com/manual/changeStreams/

publish example:

import PublishChangeStream from "meteor/kschingiz:publish-change-streams";

Meteor.publish("myCollection", function() {
  return new PublishChangeStream(MyCollection, [
    { $addFields: { "fullDocument.newField": "this is an added field!" } }
  ]);
});

Contributions, discussions are welcome!