New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mongodb-activity-feed

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongodb-activity-feed

Activity Feeds, Timeline, Notification Feed, News Feed with MongoDB, Mongo

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

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 https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type to reduce the need for locks.

News Feed Mongo

Notification Feed Node

Timeline

Init

import {FeedManager} from 'mongodb-activity-feed'
const fm = new FeedManager(mongoConnection, redisConnection)
fm.feed('user', '123')

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)

Running tests

NODE_ENV=test node_modules/mocha/bin/_mocha --timeout 15000 --require test-entry.js "test/**/*.js"

Or if you're lazy

yarn test

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.

FAQs

Package last updated on 29 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc