Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-hook-createdmodified

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-hook-createdmodified

Mongoose plugin, adding `createdAt` and `modifiedAt` timestamp fields to document. `modifiedAt` is changed on any type of update.

  • 0.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
890
decreased by-19.46%
Maintainers
1
Weekly downloads
 
Created
Source

mongoose-hook-createdmodified

Mongoose plugin, adding createdAt and modifiedAt timestamp fields to document. modifiedAt is changed on any type of update.

Installation

git clone git@github.com:tarquas/mongoose-hook-createdmodified.git mongoose-hook-createdmodified

Package

{
  "mongoose-hook-createdmodified": "0.1.4"
}

Usage

Example: enable 'createdAt' and 'modifiedAt' fields on a schema:

var
  mongoose = require('mongoose'),
  createdModifiedPlugin = require('mongoose-hook-createdmodified'),
  PersonSchema;

PersonSchema = {
  name: String,
  email: String
};

PersonSchema.plugin(createdModifiedPlugin, {mongoose: mongoose});

mongoose.model('Person', PersonSchema);

Notes

  • This plugin must be provided with an exact instance of mongoose, where the processing models expected to be processed, in opts parameter.

  • This plugin updates modification time of the document on its any update operation. It's based on mongoose-hook plugin, so every time, any of insert, update, or findAndModify database API wrapper is called, the creation/modification time is updated.

Keywords

FAQs

Package last updated on 08 May 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc