mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-25 21:53:14 -05:00
MongoDB TextEncoder is not defined fix (#4499)
This commit is contained in:
parent
77405a7232
commit
43abf32dba
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…
x
Reference in New Issue
Block a user