Skip to content

Instantly share code, notes, and snippets.

@aluzed
Created February 16, 2018 19:23
Show Gist options
  • Save aluzed/7e8b11f0c7c1fdaaafd32402505122ac to your computer and use it in GitHub Desktop.
Save aluzed/7e8b11f0c7c1fdaaafd32402505122ac to your computer and use it in GitHub Desktop.
const { ColumnMissing } = require('massive-collections/errors.js');
const Collection = require('massive-collections');
module.exports = (app) => {
// Get our db from app object
const db = app.get('db');
const Users = new Collection('users', db);
/**
* Before each update, update modified field
*/
Users.preHook('update', function (next, data) {
data.modified = new Date();
next(data);
});
return Users;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment