i don't know if this answer will be relevent to you but, i faced the same problem in my code too, hope this might help someone because i was not able to find anything regarding this. my problem was that i was creating the connection in a different directory and trying to get the data from another directory where my main query was written . both this directory had their own mongoose node modules . so due to conflict it was causing this error. so i would recommend to keep all the mongoose related data like connection , queries, models etc in one place that way you wont have to worry about this complications.