From c008c4d30afd6e051a74603c3fbbe89efbc3feb3 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Tue, 28 Jan 2014 23:01:11 -0800 Subject: [PATCH] Add more comments --- lib/dao.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/dao.js b/lib/dao.js index 3352579a..118717e9 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -544,9 +544,13 @@ DataAccessObject.find = function find(params, cb) { if (params && params.include) { if (params.collect) { - // Return the collected item for through models + // The collect property indicates that the query is to return the + // standlone items for a related model, not as child of the parent object + // For example, article.tags obj = obj.__cachedRelations[params.collect]; } else { + // This handles the case to return parent items including the related + // models. For example, Article.find({include: 'tags'}, ...); // Try to normalize the include var includes = params.include || []; if (typeof includes === 'string') {