happn-service-mongo-2

4.0.1 • Public • Published

npm Build Status Coverage Status David

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

Readme

Keywords

Package Sidebar

Install

npm i happn-service-mongo-2

Weekly Downloads

25

Version

4.0.1

License

none

Unpacked Size

666 kB

Total Files

41

Last publish

Collaborators

  • jeggers
  • smc-tenacious