From aca43d8ed7d092e2812b23d68c4779cca817ef2f Mon Sep 17 00:00:00 2001 From: Ryan Blenis Date: Fri, 8 Nov 2019 10:20:35 -0500 Subject: [PATCH] Add NeDB compatibility --- db.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/db.js b/db.js index 116f6802..d0f8adad 100644 --- a/db.js +++ b/db.js @@ -895,6 +895,21 @@ module.exports.CreateDB = function (parent, func) { func(r); }); } + + // Add a plugin + obj.addPlugin = function (plugin, func) { obj.pluginsfile.insert(plugin, func); }; + + // Get all plugins + obj.getPlugins = function (func) { obj.pluginsfile.find().sort({ name: 1 }).exec(func); }; + + // Get plugin + obj.getPlugin = function (id, func) { obj.pluginsfile.find({ _id: id }).sort({ name: 1 }).exec(func); }; + + // Delete plugin + obj.deletePlugin = function (id, func) { obj.pluginsfile.remove({ _id: id }, func); }; + + obj.setPluginStatus = function(id, status, func) { obj.pluginsfile.update({ _id: id }, { $set: {status: status } }, func); }; + } func(obj); // Completed function setup