Package Exports
- mongodb-activity-feed
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mongodb-activity-feed) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Activity Feed Node & Mongo DB
Simple example of how to build a news feed with Node and MongoDB. I created it for this blogpost: "Building Activity Feeds with MongoDB vs the alternatives"
https://docs.google.com/document/d/11gfMOPgE476fLsb2sXYy955X2G4egUv4p7-zlXdf8hU/edit
It uses CRDTs to reduce the need for locks.
Init
import {FeedManager} from 'mongodb-activity-feed'
const fm = new FeedManager(mongoConnection, redisConnection)
fm.feed('user', '123')News Feed Mongo
Notification Feed Node
Timeline
Adding an activity
Add an activity like this.
fm.addActivity(activity, feed)fm.removeActivity(activityID)fm.removeActivityFromFeed(activityID, feed)Follow a feed
fm.follow(a, b)
fm.unfollow(a, b)Read a feed from MongoDB
fm.readFeed('user', '123', options)Pros/Cons
The cost/performance of a MongoDB based activity feed is substantially worse compared to Stream (https://getstream.io/). Unless you need to run your feeds on-prem you should not use this in prod.
Contributing
Running tests
NODE_ENV=test node_modules/mocha/bin/_mocha --timeout 15000 --require test-entry.js "test/**/*.js"Or if you're lazy
yarn testLinting
yarn lint