From cee7029445c4578cec1241ca12d5063231d869da Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Mon, 25 Mar 2013 01:22:50 +0400 Subject: [PATCH] Started docs for model, changelog --- docs/changelog.md | 2 +- docs/model.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index e7596c85..b8d4c29a 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -5,7 +5,7 @@ jugglingdb-changelog(3) - The History of JugglingDB ### upcoming release -* Documentation in web and man +* Documentation in [web][http://jugglingdb.co] and man ### 0.2.1 diff --git a/docs/model.md b/docs/model.md index b0d12c87..4d462a03 100644 --- a/docs/model.md +++ b/docs/model.md @@ -7,6 +7,39 @@ This section describes common methods of models managed by jugglingdb and explains some model internals, such as data representation, setters, getters and virtual attributes. +## ESSENTIALS + +### Default values + +## DB WRITE METHODS + +### Model.create([data[, callback]]) + +Create instance of Model with given data and save to database, invoke callback +when ready. Callback accepts two arguments: error and model instance. + +### Model.updateAttributes(data[, callback]); +### Model.updateAttributes(data[, callback]); + +## DB READ METHODS + +### Model.all([params[, callback]]) + +Find all instances of Model, matched by query. Fields used for filter and sort +should be declared with `{index: true}` in model definition. + +* `param`: + * where: Object `{ key: val, key2: {gt: 'val2'}}` + * include: String, Object or Array. See AbstractClass.include documentation. + * order: String + * limit: Number + * skip: Number + +* `callback`: + Accepts two arguments: + * err (null or Error) + * Array of instances + ## SEE ALSO jugglingdb-schema(3)