summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean Fridman <fridman@mail.sfsu.edu>2015-04-09 12:38:10 -0400
committerSean Fridman <fridman@mail.sfsu.edu>2015-04-09 12:38:10 -0400
commite5d2c46da817cf4303d1daca89ef8e18d347fdb4 (patch)
tree7adab881ad0e1bf683eafed503673a23d3a14031 /app
parentfa6d57bab8fe7cf0810f577639d59ba6053e0a15 (diff)
Implement FSBD.find
Diffstat (limited to 'app')
-rw-r--r--app/node_modules/okdb/index.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/node_modules/okdb/index.js b/app/node_modules/okdb/index.js
index 5368e4a..79ce1eb 100644
--- a/app/node_modules/okdb/index.js
+++ b/app/node_modules/okdb/index.js
@@ -48,10 +48,10 @@ FSDB.prototype._resolve = function(data, error) {
};
FSDB.prototype.get = function(collection, query) {
- var data = this._db(collection).find(query);
if (!query) {
return this._resolve(null, new Error('No query given'));
} else {
+ var data = this._db(collection).find(query);
return this._resolve(data);
}
};
@@ -85,8 +85,13 @@ FSDB.prototype.remove = function(collection, id, data) {
throw new Error('Not implemented!');
};
-FSDB.prototype.find = function(collection, id, data) {
- throw new Error('Not implemented!');
+FSDB.prototype.find = function(collection, query) {
+ if (!collection || !query) {
+ return this._resolve(null, new Error('Bad input'));
+ } else {
+ var data = this._db(collection).find(query);
+ return this._resolve(data);
+ }
};
FSDB.prototype.getMeta = function() {