Name: ssb-mongo-connect
Owner: TABLEFLIP
Description: Connect ssb messages to mongo collections.
Created: 2017-06-12 10:05:16.0
Updated: 2017-06-12 10:14:33.0
Pushed: 2017-06-12 11:12:57.0
Size: 81
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Connect ssb messages to mongo collections.
sbot = require('scuttlebot')({ /* ... */ })
connect = require('ssb-mongo-connect')
db = require('mongojs')('blog', ['posts'])
Posts = db.collection('posts')
conn = connect(sbot, 'add-post')(Posts)
ll future add-post messages will now appear in the Posts collection
Call `conn.abort()` to stop)
connect(sbot, messageType[, opts])(collection)
Connect scuttlebot messages of type messageType
to the mongo collection
.
sbot
(Scuttlebot
) a scuttlebot servermessageType
(String
|Array
) the type(s) of message to connect to this collection[opts.transform]
(Function
) async transform the message contents before inserting into mongo (signature is transform (content, cb)
). Callback with null
to effectively filter messages[opts.gte]
(Number
) optional timestamp after which to start receiving messages (default Date.now()
)[opts.concurrency]
(Number
) the number of concurrent mongo inserts (default 1 to maintain message order)collection
(Object
) a mongo collection objectReturns a pull-abortable
instance, allowing you to call abort([err])
in order to stop the connection.
A (?°?°???TABLEFLIP side project.