Need help with activity-streams-mongoose?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

127 Stars 22 Forks Apache License 2.0 50 Commits 3 Opened issues


Activity Streams Real-Time Data Store backed by MongoDB(via Mongoose) and Redis

Services available


Need anything else?

Contributors list

No Data

build status

Author: Monica Wilkinson Copyright (c) 2012 VMware, Inc


Activity Streams is a simple specification used to describe social actions around the web.

This library provides the following Activity Stream Models on Mongoose:

  • ActivityObject
  • Activity

For details on the properties each see pne of the following specifications:




var streamLib = require('activity-streams-mongoose')(options);

// Here you can extend the schemas with any plugins streamLib.types.UserSchema.plugin(function(schema, options) { schema.add({ lastMod: {type: Date, default: date}}); });

var asmsDB = new streamLib.DB(streamLib.db, streamLib.types);

Or explicit if you need a Mongoose reference in your calling code

var mongoose = require('mongoose');
var streamLib = require('activity-streams-mongoose')(mongoose, options);
var asmsDB = new streamLib.DB(streamLib.db, streamLib.types);


  • mongoUrl --> If you want to let

    manage Mongoose for you, just pass the url for the MongoDB. Example format is
  • redis --> Hash including keys specifying connection properties

    • host
    • port
    • pass
    • database

Redis is required to be able to publish activities and subscribe to Activity Streams

To create an activity object you can do

var cf = new asmsDB.ActivityObject({displayName: "Cloud Foundry" , url: ""}); (err) {

To create an activity with an associated activity object you can do

var testAct = new asmsDB.Activity({title: "Started the app", target: target._id}); (err) {

To query the Activity Streams do

Asking for the latest 5 from stream "sfgiants"

asmsDB.Activity.getStream("sfgiants", 5, function (err, docs) {

Asking for the latest 5 from firehose

asmsDB.Activity.getFirehose(5, function (err, docs) {

To publish an activity you can do

var testAct = new asmsDB.Activity({title: "Started the app", target: target._id});

Note: This will save the activity and then publish it to the stream name

To subscribe to an Activity Stream do

var clientSendFx =  function(channel, json) {

asmsDB.Activity.subscribe('cloudfoundry-stream', clientSendFx);

To close the Activity Stream DB connections (MongoDB and Redis)


To run tests

  • Start MongoDB
  • Start Redis
npm test


Apache License

See LICENSE file for more details

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.