Issue with MongoDB Connection Setup
Error Message: Failed to resolve module 'C:\Users\luci\Desktop\Lunar Bot\modules\data\MongoDB.js': ExpectedValidationError > s.instance(V)
A TypeScript bot encountering errors when converting to JS on load.
import mongoose from "mongoose";
export class MongoConnection {
public versions = "^7";
public mongoose!: typeof mongoose;
async onstart() {
this.mongoose = await mongoose.connect(process.env.MONGODB!);
if (this.mongoose) console.log("Connected to MongoDB Database");
return true;
}
}
export default new MongoConnection();
JS Code Conversion:
import mongoose from "mongoose";
export class MongoConnection {
constructor() {
this.versions = "^7";
}
async onstart() {
this.mongoose = await mongoose.connect(process.env.MONGODB);
if (this.mongoose)
console.log("Connected to MongoDB Database");
return true;
}
}
export default new MongoConnection();
//# sourceMappingURL=MongoDB.js.map
Seeking insights into the error encountered during setup.