Ticket: Migration MongoError

Hello, I get this error when I am trying to perform the migration and I don’t know what to do. The error is on the third line when declaring

const MongoError = require("mongodb").MongoError

and it says:

TypeError: Class constructor MongoError cannot be invoked without 'new'

Thank you.

My boss solved it:

Changed the require MongoError line to:

const mongo = require("mongodb")

and then in line 50ish in the catch substitute MongoError with:

mongo.MongoError

1 Like