Git Product home page Git Product logo

mongoose-audit's People

Contributors

cesarob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mongoose-audit's Issues

Be able to store the update operation when doing a bulk update log

Due to a bug in mongodb driver:

Error: key $set must not start with '$'
at Error (<anonymous>)
at Function.checkKey (/home/cesar/repos/mongoose-audit/node_modules/mongoose/node_modules/mongodb/node_modules/bson/lib/bson/bson.js:1472:13)

We need to modify the update object. Example:

{'$set': {value: 'foo'}}

will be stored as:

{'set': {value: 'foo'}}

Now we are using Mongoose 3.X (which is using Mongodb 1.X). Research if it is also happening with Mongoose 4.X (which uses Mongodb 2.X).

Whereas the problem persists we could provide a helper operation in order to convert the operation to its original state (in order to to this we could just move the $ to the last position of the key, instead removing it).

mongoose-audit is not fetching data

Hi, I want to list all of the log records from API but it's not working.
Anyone knows how to fetch audit-log data from db collection?

Currently I am doing this.

let AuditHistory = ('mongoose-audit').model;
AuditHistory.find({user: req.body.email}, {page: page, limit: limit}, (err, result) => {
    if (err) return res.send({message: '1155', err})
    if (!result) return res.send({message: '2351'})
    return res.send({message: '2265', result})
  })

A post hook should be use to store the modified document

Actual implementation uses pre hooks to store data in the document and in the audit log.
The change in the audited document should be kept in the pre hook but the storage in the audit log should be moved to a post hook.

Actual implementation generates false entries in the log.

using Model.update nothing happens.

I added console logs to all of the functions to see what fired. When I create a new document, I get stuff put into the audit log database. When I run a Model.update, nothing fires. How can I change this?

Create examples of ways to inject the context of an operation

In order to have the context of an operation you need to provide a _user and an _action in the document.
This is out of the scope of the plugin, bug examples of how to do it could be provided.
It could be real code, or just entries in the wiki.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.