UNPKG

nodejs-rigorous

Version:
15 lines (10 loc) 609 B
const ObjectCrud = require('../ObjectCrud/index'); /* eslint no-param-reassign:0 */ module.exports = (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); };