From 49fe2bfc0efc8c25c3aea66a6cf94e345d79263c Mon Sep 17 00:00:00 2001 From: shubhankar Date: Fri, 21 Jul 2017 10:27:06 +0000 Subject: [PATCH 1/3] punctions --- README.md | 6 +++--- index.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1fd58c7..b5e81b1 100755 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Support for where is added as following: ?where={"name":{"contains":"firstName lastName"}} ?where={"name":{"beginsWith":"firstName"}} ?where={"name":{"in":["firstName lastName", "another name"]}} - ?where={"name":{"between":["firstName, "lastName"]}} + ?where={"name":{"between":["firstName", "lastName"]}} ``` ### Pagination @@ -174,7 +174,7 @@ Multiple GSIs: GameTitle: { type: 'string', primaryKey: 'hash' - index: ['GameTitleIndex-hash'. 'SomeOtherIndex-hash'] + index: ['GameTitleIndex-hash', 'SomeOtherIndex-hash'] } ``` @@ -183,7 +183,7 @@ Multiple GSIs and a secondary index: GameTitle: { type: 'string', primaryKey: 'hash' - index: ['secondary', GameTitleIndex-hash'. 'SomeOtherIndex-hash'] + index: ['secondary', 'GameTitleIndex-hash', 'SomeOtherIndex-hash'] } ``` diff --git a/index.js b/index.js index 7765ece..938fe3c 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ var filters = { beginsWith: true, //?where={"name":{"in":["firstName lastName", "another name"]}} in: true, - //?where={"name":{"between":["firstName, "lastName""]}} + //?where={"name":{"between":["firstName", "lastName"]}} between: true }; From 740ee21ea4521c2c234cadca6a04141ae5b3023d Mon Sep 17 00:00:00 2001 From: shubhankar Date: Fri, 21 Jul 2017 10:59:05 +0000 Subject: [PATCH 2/3] added 'select' option to query --- index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.js b/index.js index 938fe3c..b8b25d1 100644 --- a/index.js +++ b/index.js @@ -951,6 +951,14 @@ module.exports = (function () { query.loadAll(); } + if ('select' in options) { + if (_.isString(options.select)) { + query = query.attributes([options.select]); + } else { + query = query.attributes(options.select); + } + } + return query; }, From a2da011a63fc2dc75fceca9166ed92f0b93862a3 Mon Sep 17 00:00:00 2001 From: Shubhankar Date: Fri, 21 Jul 2017 14:19:37 +0000 Subject: [PATCH 3/3] Documentation for "select" option in find query --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index b5e81b1..b4c7445 100755 --- a/README.md +++ b/README.md @@ -69,6 +69,11 @@ Support for where is added as following: ?where={"name":{"in":["firstName lastName", "another name"]}} ?where={"name":{"between":["firstName", "lastName"]}} ``` +You can specify what attributes/keys should be returned from the query as following: +``` + //This will return only name and age in the result (if the field exists in the result) + ?where={"name":{"equals":"firstName lastName"}, "select": ["name","age"]} +``` ### Pagination __NOTE__: `skip` is not supported!