Update create api docs

This commit is contained in:
Ritchie Martori 2013-06-21 14:59:30 -07:00
parent b426caccd3
commit 68e4464c59
1 changed files with 4 additions and 2 deletions

View File

@ -162,14 +162,16 @@ Mixins are added by attaching a vanilla model to a data source with a connector.
#### Static Methods
##### Model.create([data], [callback])
##### Model.create(data, [callback])
Create an instance of Model with given data and save to the attached data source.
Create an instance of Model with given data and save to the attached data source. Callback is optional.
User.create({first: 'Joe', last: 'Bob'}, function(err, user) {
console.log(user instanceof User); // true
});
**Note:** You must include a callback and use the created model provided in the callback if your code depends on your model being saved or having an `id`.
##### Model.count([query], callback)
Query count of Model instances in data source. Optional query param allows to count filtered set of Model instances.