@expander/mongoose-tracker
Version:
Is a mongoose plugin that automatically keeps track of when the document has been created, updated and optionally when some fields have been modified
22 lines (21 loc) • 504 B
TypeScript
import mongoose from 'mongoose';
export interface Options {
name?: string;
limit?: number;
fieldsToTrack?: string[];
fieldsNotToTrack?: string[];
instanceMongoose?: typeof mongoose;
}
export interface Change {
field: string;
before: string | null;
after: string | null;
}
type Action = 'updated' | 'created' | 'deleted' | 'removed' | 'added';
export interface History {
changes: Change[];
at: number;
changedBy: string | null;
action: Action;
}
export {};