0

I am using MERN to develop a poll app. I have 6 collections in my database. I have an API for each collection, 4 of those API returns the data whereas the other 2 return 'undefined'. What is the issue I am facing? Is MongoDB not allowing me to use more than 4 collections?

Comments
  • 1
    I have not seen any restriction
  • 0
    @Voxera you have any idea what the issue might be? I can send the snaps of code and my collections. I went through the code a couple of times looking for typos but couldn't find one.
  • 3
    there is no such thing. look at your models and your queries. maybe the answer lies there
  • 0
    @JhonDoe I went through my models, my schema and everything it is exactly the same as my other collections but still I didn't get the expected results
  • 1
    I figured out the mistake, the name of collection must be in different from the name we are referring in our API. For instance in my 'surprise' API was referring to 'surprise' collection but when I changed my collection name to 'surprises' it started working fine
  • 2
    you shouldn't be doing that unless you are not using mongoose or another ORM, or you are using the orm in a strange way
Add Comment