Hi everyone. II’d to to ask why my node.js can’t connect to mongodb. it shows “Internal server error: MongoDB collection not available”. Did I make mistakes on codes or something, Can anyone reach out for this problem. Thank you.
Hi @dydyyy_N_A,
Welcome to the MongoDB Community forums!
Based on the shared screenshot, it seems you are calling db.collection , but in fact, you have passed the database name in the variable dbname . That’s the reason the error is occurring for you.
Instead of db.collection , you should be calling dbname.collection
or passing the database name to the variable db .
I hope it helps!
Best regards,
Kushagra
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.


