summaryrefslogtreecommitdiff
path: root/app/node_modules/okresource/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/node_modules/okresource/index.js')
-rw-r--r--app/node_modules/okresource/index.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/node_modules/okresource/index.js b/app/node_modules/okresource/index.js
index df89617..8c0bb16 100644
--- a/app/node_modules/okresource/index.js
+++ b/app/node_modules/okresource/index.js
@@ -122,12 +122,21 @@ OKResource.prototype.update = function(id, data) {
reject(new Error('No resource ID provided'));
} else if (!data) {
reject(new Error('No data provided'));
- }else {
+ } else {
db.update(type, id, data).then(resolve).fail(reject);;
}
});
};
+
+/**
+ * Get all documents in collection sorted by property,
+ * optionally in descending order
+ */
+OKResource.prototype.sortBy = function(prop, descend) {
+ return this._db.sortBy(this.type, prop, descend);
+};
+
/**
* Update all resources with the given ids with the given data
*/