geilt

Untitled

Jul 25th, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Console:
  2.  
  3. { key: /^asdgfasdfg$/gi, _id: { '$ne': { '$in': [Object] } } }
  4.  
  5.  
  6. /**
  7.  * Meta
  8.  *
  9.  * @module      :: Model
  10.  * @description :: A short summary of how this model works and what it represents.
  11.  * @docs        :: http://sailsjs.org/#!documentation/models
  12.  */
  13.  
  14. module.exports = {
  15.     schema: true,
  16.     attributes: {
  17.         key: {
  18.             type: 'string',
  19.             required: true,
  20.         },
  21.         value: {
  22.             type: 'string',
  23.             required: true
  24.         },
  25.         label: {
  26.             type: 'string',
  27.             required: true
  28.         },
  29.         description: {
  30.             type: 'string',
  31.         },
  32.         order: {
  33.             type: 'integer',
  34.             defaultsTo: 0
  35.         },
  36.     },
  37.     beforeCreate: function(attrs, next) {
  38.         attrs = formats(attrs)
  39.         next(null, attrs);
  40.     },
  41.     beforeUpdate: function(attrs, next) {
  42.         attrs = formats(attrs)
  43.         next(null, attrs);
  44.     }
  45. };
  46. function formats(attrs) {
  47.     return attrs;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment