1.0.0 • Published 6 years ago
mongodb-actions-manager v1.0.0
mongodb-actions-manager
TypeScript library to save the action data from the package actions-tracker to a mongodb database
Quickstart
npm package: https://www.npmjs.com/package/mongodb-actions-manager
#package installation
npm install mongodb-actions-manager
How to use
This package doesn't manage/validate the action's data; it simply get an action and try to save it as a MongoDB document.
To use it you only must:
- Create and configure the main controller
- Pass this object to the actions-tracker main controller
- Invoke
save()
method to the actions-tracker main controller
Configuration
It's possible customize the save settings passing a json in this format (TypeScript syntax)
{
index?: {
actors?: {
identifier?: boolean,
humanIdentifier?: boolean,
actorType?: boolean
},
operation: {
action?: boolean,
module?: boolean
}
},
schema?: {
schemaName?: string
}
}
For now it's only possible customize which values will be index and the name of the schema into MongoDB.
Example
//.... (connection to MongoDB)
//.... (action creation)
var dbmanager = new MongodbActionTracker({
index: {
actors: {
identifier: true,
humanIdentifier: false,
actorType: false
},
operation: {
action: true,
module: false
}
},
schema: {
schemaName: 'my-actions'
}
});
const manager = new ActionManager(action, dbmanager);
manager.save();