|
after: {Date object}
|
|
alpha: {boolean}
|
|
alphadashed: {boolean}
|
|
alphanumeric: {boolean}
|
|
alphanumericdashed: {boolean}
|
|
array: {boolean}
strings formatted as arrays don't pass
|
|
before: {Date object}
|
|
boolean: {boolean}
strings fail
|
|
contains: {string?RegEx?}
|
|
creditcard: {boolean}
|
|
date: {boolean}
|
|
datetime: {boolean}
|
|
decimal: {boolean}
|
|
email: {boolean}
|
|
empty: {boolean}
|
|
equals: {mixed}
=== comparison
|
|
falsey: {boolean}
|
|
finite: {boolean}
can be coerced to a finite number
|
|
float: {boolean}
|
|
hexadecimal: {boolean}
|
|
hexColor: {boolean}
|
|
in: {array}
|
|
int: {boolean}
alias for integer
|
|
integer: {boolean}
|
|
ip: {boolean}
IPv4 or IPv6
|
|
ipv4: {boolean}
|
|
ipv6: {boolean}
|
|
is: {RegEx}
|
|
json: {boolean}
|
|
len: {?}
is integer > param1 && < param2. (Where are params defined?)
|
|
lowercase: {boolean}
|
|
max: {number}
|
|
minLength: {int}
|
|
not: {RegEx}
|
|
notContains: {string?RegEx?}
|
|
notEmpty: {boolean}
|
|
notIn: {string|array}
|
|
notNull: {boolean}
|
|
notRegex: {boolean?}
|
|
null: {boolean}
|
|
number: {boolean}
NaN is considered a number
|
|
numeric: {boolean}
string contains only numbers
|
|
object: {boolean}
|
|
regex: {boolean?}
|
|
protected: {boolean}
remove attribute when toJSON is called on instance
|
|
required: {boolean}
during creation only
|
|
string: {boolean}
|
|
text: {boolean}
|
|
truthy: {boolean}
|
|
undefined: {boolean}
|
|
unique: {boolean}
|
|
uppercase: {boolean}
|
|
url: {boolean}
|
|
urlish: {boolean}
/^\s([^\/]+.)+.+\s*$/g
|
|
uuid: {boolean}
UUID v3, v4 or v5
|
|
uuidv3: {boolean}
|
|
uuidv4: {boolean}
|
|
Message: {id,verb:'messaged',data}
|
|
Message: {id,verb:'created',data}
|
|
Message: {id,verb:'updated',data:object,previous:object}
|
|
Message: {id,verb:'addedTo',attribute,addedId}
|
|
Message: {id,verb:'destroyed',previous}
|
|
Message: {id,verb:'removedFrom',attribute,removedId}
|
|
Subscribes to record(s) changes. Works for socket requests only.
|
|
Unsubscribes from record(s) changes. Works for socket requests only.
|
|
Subscribe to publishCreate(). Works for socket requests only.
|
|
Unsubscribe to publishCreate(). Works for socket requests only.
|
|
beforeValidate: {fn(values, next)}
create and update
|
|
afterValidate: {fn(values, next)}
create and update
|
|
beforeCreate: {fn(values, next)}
|
|
afterCreate: {fn(newlyInsertedRecord, next)}
|
|
beforeUpdate: {fn(valuesToUpdate, next)}
|
|
afterUpdate: {fn(updatedRecord, next)}
|
|
beforeDestroy: {fn(criteria, next)}
|
|
afterDestroy: {fn(destroyedRecords, next)}
|
|
query(query, callback(err, results))
Only works with PostgreSQL and mySQL
|
|
native(callback(err, collection))
Only works with MongoDB. For low-level usage do
require('mongodb') directly.
|
|
count([criteria], [callback]) {query}
|
|
find(criteria, [callback]) {query}
|
|
findOne(criteria, [callback]) {query}
|
|
findOrCreate(criteria, [callback]) {query}
|
|
create(data, [callback]) {query}
|
|
destroy(criteria, [callback]) {query}
|
|
update(criteria, data, [callback]) {query}
|
|
stream(criteria, [options]) {stream}
|
query object which ends with .exec(callback)
|
Add a many2many relationship
|
|
Remove a many2many relationship
|
|
Contains instance methods
|
|
Does not contain instance methods
|
|
persists any changes to the database. Required for add() / remove()
|
|
Executes a query at the end of a query chain.
|
|
Bluebird Promise Method
|
|
Bluebird Promise Method
|
|
safe: never auto-migrate db. alter: auto-migrate db and attempt to keep existing. drop: drop all data on every lift.
|
|
only specified attributes are saved
|
|
lowercase version of filename
|
|
autoPK: {boolean}
|
|
autoCreatedAt: {boolean}
|
|
autoUpdatedAt: {boolean}
|
|
tableName: {string}
table or collection to be used
|
|
attributes: {object}
|
|
type: {string}
|
|
string
|
|
text
|
|
integer
|
|
float
|
|
date
|
|
datetime
|
|
boolean
|
|
boolean
|
|
binary
|
|
array
|
|
json
|
|
email
|
|
defaultsTo: {mixed}
|
|
autoIncrement: {boolean}
requires
type: 'integer'
|
|
unique: {boolean}
|
|
primaryKey: {boolean}
|
|
enum: {array[string]}
|
|
size: {integer}
|
|
columnName: {string}
|
|
Where:
Mode.find({ where: conditions })
|
|
{ property: 'value' }
|
|
{ property: { 'comparison': 'value' } }
Complex comparison options. Works for dates:
{ '>': new Date('2/4/2014') }
|
|
{ '<' | 'lessThan' : value }
|
|
{ '<=' | 'lessThanOrEqual' : value }
|
|
{ '>' | 'greaterThan' : value }
|
|
{ '>=' | 'greaterThanOrEqual' : value }
|
|
{ '!' | 'not' : value }
|
|
{ 'like|contains|startsWith|endsWith': value }
like:
'sea%rch' contains: '%search%' startsWith: 'search%' endsWith: '%search'
|
|
{ property: ['value1', 'value2'] }
Value in array
|
|
{ property: { '!' : ['value1', 'value2'] } }
Value not in array
|
|
{ or: [ { prop1: 'val1' }, { prop2: val2 } ] }
|
|
Limit:
Mode.find({ limit: integer })
|
|
Skip:
Mode.find({ skip: integer })
|
|
Sort:
Mode.find({ sort: sortString })
|
|
{ sort: 'property' | 'property ASC' }
|
|
{ sort: 'property DESC' }
|
|
{ sort: { 'property1' : 1, 'property2': 0 } }
|
|
model: 'model'
|
|
collection: 'model'
|
|
via: 'foreignPropertyName'
|
|
[dominant]: true
|
Thanks, very nice.
@DaveChild do you know why these columns aren't distributing evenly? It's really messing things up.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.