I'm trying to connect to a Railway MongoDB I set up with expressJS but I keep getting an "Authentication Failed" Error.
Here is my code:
import mongoose from "mongoose";
const connect = async () => {
mongoose.connect('mongodb://mongo:password@myhost.railway.app:6949')
.then(() => console.log('Connected to database movieDB'))
.catch((err: any) => console.log(err));
}
connect();
I can connect to the database using MongoDB Compass and the Intellij Database tool, so the url should be correct.