alexeypetrushin/mongo-model — Issue #1: model.save() throws TypeError: Undefined is not a function error 
Author: noazark
Created: 2012-02-02 03:45:57+00:00
State: open

Anytime I save a model I get an error on [crud.coffee](https://github.com/alexeypetrushin/mongo-model/blob/master/lib/model/crud.coffee#L22) (compiled the error is on line 26, coffeescript line 22). My code is pretty simple, gathered from the examples:

```coffee
# test-model.coffee

Model = require 'mongo-model'

class Test extends Model
@collection 'tests'

constructor: () ->
console.log "Ready, lets go"

module.exports = Test
```

```
> Test = require './test-model.coffee'
> test = new Test(message: "don't stop me now")
> test.save()

...
```

The model saves successfully into the database, but I receive this error immediately after `save()`:

```
TypeError: undefined is not a function
at /home/noazark/Desktop/node_modules/mongo-model/lib/model/crud.coffee:26:20
at /home/noazark/Desktop/node_modules/mongo-model/lib/model/crud.coffee:186:22
at /home/noazark/Desktop/node_modules/mongo-model/lib/model/crud.coffee:189:18
at /home/noazark/Desktop/node_modules/mongo-model/lib/model/callbacks.coffee:32:18
at Test.runCallbacks (/home/noazark/Desktop/node_modules/mongo-model/lib/model/callbacks.coffee:35:14)
at Test._runCallbacksRecursively (/home/noazark/Desktop/node_modules/mongo-model/lib/model/crud.coffee:174:21)
at /home/noazark/Desktop/node_modules/mongo-model/lib/model/crud.coffee:25:23
at /home/noazark/Desktop/node_modules/mongo-model/lib/model/crud.coffee:186:22
at /home/noazark/Desktop/node_modules/mongo-model/lib/model/crud.coffee:189:18
at /home/noazark/Desktop/node_modules/mongo-model/lib/model/callbacks.coffee:32:18
```