Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (320 points)

I connect to my remote machine using SSH, there I installed mongoDB on it, and I want to use it remotely, how to connect to it using nodejs and mongoDB compass? 


 

const db = "mongodb://what needs to be written here?";

const connectDB = async () => {

  try {

    await mongoose.connect(db, { useNewUrlParser: true, useCreateIndex: true });

    console.log("MongoDB Connected...");

  } catch (err) {

    console.error(err.message);

    process.exit(1);

  }

};

connectDB();

Please log in or register to answer this question.

Related questions

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Mar 6, 2021 in Java by dante07 (13.1k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

29.3k questions

30.6k answers

501 comments

104k users

Browse Categories

...