Socket
Socket
Sign inDemoInstall

q3-plugin-changelog

Package Overview
Dependencies
11
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    q3-plugin-changelog

Leveraging MongoDB's changestream, this plugin aims to track choice modifications to a document after they occur. When globally installed, the plugin will automatically watch for changes in a collection and save their update description. It also synch


Version published
Weekly downloads
9
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Changelog Plugin

Leveraging MongoDB's changestream, this plugin aims to track choice modifications to a document after they occur. When globally installed, the plugin will automatically watch for changes in a collection and save their update description. It also synchronizes with Q3 session data so that we can see who prompted the change and when.

Example usage

const  mongoose = require('mongoose');
const plugin = require('q3-plugin-changestream')
const watcher = require('q3-plugin-changestream/lib/changestream')

const Person = new  mongoose.Schema({
	name:  String,
	friends: [
		{
			since: Date,
		}
	]
}, {
	changelog: ['name', 'friends.$.since'],
});

Person.plugin(plugin);

// Must happen after all model has been declared.
// More than likely, you'll call this from a different file after a DB connection has been made.
watcher()

API

async Document.getHistory

Call this method to fetch all records created by the plugin.

Model.getChangelogProperties

Call this static method to get a list of properties the plugin is watching. Essentially, it just references the initial changelog value setup in the Schema.

FAQs

Last updated on 20 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc