happn-db-provider-mongo
v1.1.13
Published
service plugin for running happn on a mongo database, for happn-3 instances
Downloads
895
Readme
Introduction
installing mongo and redis on your local machine - for testing:
# mongo latest
docker pull mongo
docker run -p 27017:27017 -d mongo
# redis
docker pull redis
docker run -p 6379:6379 -d redis
Two configuration options:
config = {
// name of collection where happn/happner stores data
collection: 'collectioName',
// database housing the collection
url: 'mongodb://127.0.0.1:27017/databaseName'
}
Getting started
Using this plugin from happner.
npm install happner happn-service-mongo --save
See happner for full complement of config.
var Happner = require('happner');
var config = {
happn: {
plugin: 'happn-service-mongo',
config: {
collection: 'happner',
url: 'mongodb://127.0.0.1:27017/happner'
}
}
};
Happner.create(config)
.then(function(server) {
// ...
})
.catch(function(error) {
console.error(error.stack);
process.exit(1);
});
Using this plugin from happn.
npm install happn happn-service-mongo --save
See happn for full complement of config.
var Happn = require('happn');
var config = {
services: {
data: {
path: 'happn-service-mongo',
config: {
collection: 'happn',
url: 'mongodb://127.0.0.1:27017/happn'
}
}
}
};
Happn.service.create(config)
.then(function(server) {
//...
})
.catch(function(error) {
console.error(error.stack);
process.exit(1);
});
##release 0.1.0
- ability to partition db's and collections by path
- allow for update or findAndModify depending on options
- embedded LRU cache, that can use redis pubsub to share state around