I have been facing this problem and trying to fix it but can not so far.
I connected MongoDB Atlas successfully. I can see my database and collections, however I can not see the documents in the collections.
I don't know what is the problem. I got very frustrated because I have been working on it since one week :(:(
Any help would be highly appreciated!
I checked database and network accesses. I checked my user name and the password. I tethered my phone as well.
Here is my code:
const mongoose = require('mongoose')
async function main () {
mongoose.connect(process.env.DB_URI || 'mongodb://127.0.0.1/needHelpNow', {
useNewUrlParser: true,
useUnifiedTopology: true
})
.then(() => console.log('Connected'))
.catch(err => console.log(err))
}
main()
In .env file, I have DB_URI which is
DB_URI=mongodb+srv://<my user name>:<my password>@cluster0.pityslz.mongodb.net/needHelpNow?retryWrites=true&w=majority&appName=Cluster0