Skip to content

Tag: mongodb

JSON empty when is called from another file

I’m learning NodeJS and MongoDB. I dont know what is happening with this function. If I make a console.log before return user, it works fine (just print an JSON array with all info of the collection) The problem is when I call it from another file (in my case, the router). If I do this, I receive an emp…

MongoDb query return empty object

I’m trying to perform a simple .find() query on my mongodbAtlas, but the result of this query is an empty object. this is my server file: this is my routes file: this is how my document is populated: Answer I think you are missing the “await” keyword after const data….. as API data fet…