taptaptech / mongoose-audit Goto Github PK
View Code? Open in Web Editor NEWMongoose Audit plugin
License: BSD 2-Clause "Simplified" License
Mongoose Audit plugin
License: BSD 2-Clause "Simplified" License
Integrate it with travis-ci.org.
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).
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})
})
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.
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?
As the context of the operation (_action and _user) is stored in the document we should be able to receive it in the LogBulkDelete interface.
Make usage of a library to be able to do json diffs. Example: https://github.com/benjamine/jsondiffpatch or similar.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.