In my experience this happens when your database is not connected, Try checking out following things –
- Is you database connected and you are pointing to the same url from your code.
- check if your
mongoose.connect(...)
code is loading.
I faced this issue where I was running the node index.js
from my terminal and mongoose connect code was into different file. After requiring that mongoose code in index.js it was working again.