use new nedb instead of old

Simon Smith committed Sep 7, 2023 at 19:31 UTC 7ea744fdfe3d74ed2d07973ba8024423432dc605
1 file changed +4 -1
db.js
+4 -1
@@ -3181,7 +3181,10 @@ module.exports.CreateDB = function (parent, func) {
3181
3182 // Transfer NeDB data into the current database
3183 obj.nedbtodb = function (func) {
3184 - var nedbDatastore = require('nedb');
3184 + var nedbDatastore = null;
3185 + try { nedbDatastore = require('@yetzt/nedb'); } catch (ex) { } // This is the NeDB with fixed security dependencies.
3186 + if (nedbDatastore == null) { nedbDatastore = require('nedb'); } // So not to break any existing installations, if the old NeDB is present, use it.
3187 +
3188 var datastoreOptions = { filename: parent.getConfigFilePath('meshcentral.db'), autoload: true };
3189
3190 // If a DB encryption key is provided, perform database encryption