JSPM

mongoose-human-diff-plugin

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q31898F
  • License MIT

See how your documents change in human readable form

Package Exports

  • mongoose-human-diff-plugin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mongoose-human-diff-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mongoose-human-diff-plugin

build status code coverage code style styled with prettier made with lass license npm downloads

See how your documents change in human readable form

Table of Contents

Install

npm:

npm install mongoose-human-diff-plugin

yarn:

yarn add mongoose-human-diff-plugin

Usage

const MongooseHumanDiffPlugin = require('mongoose-human-diff-plugin');
const mongoose = require('mongoose');

const MySchema = new mongoose.schema({
  ...
});

const changeCallback = diff => console.log(diff.join('\n'))

const options = {}

MySchema.plugin(mongooseHumanDiffPlugin(changeCallback), options)

About

mongoose-human-diff-plugin is a wrapper around human-object-diff

All options are directly passed to the human-object-diff library.

Use it to respond to changes in your documents.

For Example, let's say you have a User Schema where the users can change personal information. You could use mongoose-human-diff-plugin to send an email to users alerting them of the changes. Simply, add the email logic in your callback, and use the human readable changes to alert them. This could be applied to changes in schemas that you need to alert any one about!

Contributors

Name Website
Spencer Snyder http://spencersnyder.io/

License

MIT © Spencer Snyder