diff options
Diffstat (limited to 'app/node_modules/okdb/index.js')
| -rw-r--r-- | app/node_modules/okdb/index.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/node_modules/okdb/index.js b/app/node_modules/okdb/index.js index 79ce1eb..4be646d 100644 --- a/app/node_modules/okdb/index.js +++ b/app/node_modules/okdb/index.js @@ -81,8 +81,15 @@ FSDB.prototype.create = function(collection, data) { return this._resolve(created); }; -FSDB.prototype.remove = function(collection, id, data) { - throw new Error('Not implemented!'); +FSDB.prototype.remove = function(collection, query) { + if (!collection || !query) { + return this._resolve(null, new Error('Bad input')); + } else { + var data = this._db(collection).removeWhere(query); + if (!data) + var error = new Error('Cannot remove nonexistent entry'); + return this._resolve(data, error); + } }; FSDB.prototype.find = function(collection, query) { |
