Socket
Socket
Sign inDemoInstall

iridium-timestamps

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    iridium-timestamps

Iridium plugin for automatic creation and modification timestamping


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Install size
5.34 kB
Created
Weekly downloads
 

Readme

Source

Iridium Modification Timestamps

This plugin adds the ability to keep track of createdOn and modifiedOn properties on models defined using Iridium, a high performance MongoDB ODM.

Install

npm install iridium-timestamps

Dependencies

You'll need Iridium to use this plugin, but other than that there are no external dependencies.

Example

var iridium = require('iridium'),
    modts = require('iridium-timestamps');

iridium.register(modts);

module.exports = function(db) {
	var schema = {

	};

	var options = {
		timestamps: {
			createdProperty: 'createdOn',
			modifiedProperty: 'modifiedOn',
			now: function() { return new Date(); },
			persist: true
		}
	};
};

Options

  • createdProperty string|false Determines the name of the property use to store the created timestamp (default "createdOn"). If set to false, disables this property.
  • modifiedProperty string|false Determines the name of the property used to store the modified timestamp (default "modifiedOn"). If set to false, disables this property.
  • now function Allows you to specify a custom function used to set the current time data for the database (default function() { return new Date(); }).
  • persist boolean Used to prevent creation and modification timestamps from being stored in the database (default true). If you set this to false, be aware that "createdOn" will reflect the time at which the instance was retrieved from the database.

Features

  • Easy to add created and modified date/time information to your models
  • Highly customizable
  • Supports existing creating and saving hooks through the use of a robust wrapper function
  • Allows values to be stored "in-memory" if usage scenarios don't require them to be stored in the database.

Keywords

FAQs

Last updated on 12 Jan 2014

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