ew-action-mongodb
Advanced tools
Comparing version
{ | ||
"name": "ew-action-mongodb", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Mongo Action connector for eWings framework", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -33,12 +33,12 @@ [](https://travis-ci.org/Lingbe/ewActionMongo) [](https://coveralls.io/github/Lingbe/ewActionMongo?branch=master) | ||
``` | ||
```json | ||
{ | ||
id : 1, | ||
status : 'request', | ||
type : 'user/insert', | ||
owner : 'owner', | ||
payload: { | ||
name : 'john doe', | ||
age : 25, | ||
status: 'online' | ||
"id" : 1, | ||
"status" : "request", | ||
"type" : "user/insert", | ||
"owner" : "owner", | ||
"payload": { | ||
"name" : "john doe", | ||
"age" : 25, | ||
"status": "online" | ||
} | ||
@@ -54,5 +54,5 @@ }; | ||
```javascript | ||
const eventType = `${collection}/${action}/${parameter}`; | ||
``` | ||
${collection}/${action}/${parameter} | ||
``` | ||
@@ -72,3 +72,4 @@ Collection and action are mandatory of the event type, while parametes is option. An action can only have one of the follow values: | ||
In order to setup the eWing Mongo Action we need a connection to mongoDB and define the model behaviour. | ||
``` | ||
```javascript | ||
const eWings = require('ewings'); | ||
@@ -83,3 +84,3 @@ const ewActionMongo = require('ew-action-mongodb'); | ||
const mongoAction = ewActionMongo(config); | ||
const interfaces = [] | ||
const interfaces = []; | ||
@@ -93,3 +94,3 @@ eWings.init(interfaces, [mongoAction]); | ||
``` | ||
```javascript | ||
let db: | ||
@@ -109,6 +110,12 @@ MongoClient.connect(MongoUrlConn, (err, client) => { | ||
``` | ||
```javascript | ||
const models = { | ||
user: { schema: userSchemaMock, roles: roles }, | ||
jobs: { schema: jobsSchemaMock, actions: ['find'] } | ||
user: { | ||
schema: userSchemaMock, | ||
roles: roles | ||
}, | ||
jobs: { | ||
schema: jobsSchemaMock, | ||
actions: ['find'] | ||
} | ||
} | ||
@@ -115,0 +122,0 @@ ``` |
63840
0.16%143
5.15%