mongodb-actions-manager
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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();

Readme

Keywords

none

Package Sidebar

Install

npm i mongodb-actions-manager

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

19.4 kB

Total Files

13

Last publish

Collaborators

  • leo-sgruz