I'm currently working on part 3c, Saving Data to MongoDB. My phonebook app is able to fetch data from the MongoDB database while on the local server in development mode, but not while on the Render server. Instead of an array of the person objects, it returns just an empty array. It works fine fetching all the persons from '/api/persons' on the local server.
I put log statements in the persons.js and the index.js files to see what the Person object is and the persons object returned from MongoDB which is shown on the Render logs.

What could I be doing wrong?


The code looks fine. The only thing I can think of is that you are using 2 different databases - a local and a hosted one. The local has some data, while the one accessed by render is empty.