UNPKG

node-rigorous

Version:
15 lines (11 loc) 610 B
"use strict"; var ObjectCrud = require('../ObjectCrud/index'); /* eslint no-param-reassign:0 */ module.exports = function (schema, modelSettings) { // Functions /* Note: 1) Don't call function findById because ObjectCollection.findById exist call them fetchById 2) If Raw query -> ObjectCollection.collection.find(.....) http://www.bainweb.com/2015/06/running-rawdirectnative-mongodb-queries.html */ schema.statics.crudFunction = new ObjectCrud(modelSettings.name, modelSettings.attributesSchema, modelSettings.paginate.result.max, modelSettings.transform.fields.before.create); };