mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
MongoDB TextEncoder is not defined fix (#4499)
This commit is contained in:
parent
77405a7232
commit
43abf32dba
1 changed files with 9 additions and 4 deletions
5
db.js
5
db.js
|
@ -828,6 +828,11 @@ module.exports.CreateDB = function (parent, func) {
|
|||
} else if (parent.args.mongodb) {
|
||||
// Use MongoDB
|
||||
obj.databaseType = 3;
|
||||
|
||||
// If running an older NodeJS version, TextEncoder/TextDecoder is required
|
||||
if (global.TextEncoder == null) { global.TextEncoder = require('util').TextEncoder; }
|
||||
if (global.TextDecoder == null) { global.TextDecoder = require('util').TextDecoder; }
|
||||
|
||||
require('mongodb').MongoClient.connect(parent.args.mongodb, { useNewUrlParser: true, useUnifiedTopology: true }, function (err, client) {
|
||||
if (err != null) { console.log("Unable to connect to database: " + err); process.exit(); return; }
|
||||
Datastore = client;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue