Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (15 sloc) 615 Bytes
Mongorito = require '../lib/mongorito'
Mongorito.connect ['mongo://']
class Tweet
constructor: -> super
keys: ['body']
validateBody: (callback) -> # you should pass false, if invalid and true, if valid
if @body.length >= 140
callback false
callback true
Tweet = Mongorito.bake Tweet
tweet = new Tweet
tweet.body = 'I want to be super-super-super-super long! Reallly, reallly, long!!!! In fact, I am VEEERY long! You\'ve never seen such a looooooong tweeeeeet!' (err, results) ->
# results will be ['body'], because body field did not pass validation
Jump to Line
Something went wrong with that request. Please try again.