Saturday, 2 May 2020

"Find" not working in NodeJS

I'm trying to apply the find method to call from a mongoose model but it doesn't seem to work. I can get .findById() to work, but not just basic .find().Here is the relevant information I have. The top image is my router. I pull the "game_id" attribute from the user's input to the address and then search for it in the MongoDB collection I've imported. The second image is the model for the collection and where i get the "game_id" attribute.For example, I've done "localhost:3000/plays/22062" as a request and it gives a 500 error, indicating an error. When I do localhost:3000/plays it works, as well as when I do localhost:3000/plays/(ObjectId). What am I missing? "game_id" is a column value that essentially works as a classifier, so it'd be the same general idea as finding data that is on a specific day of the week.I have tried using two "=" instead of 3 (as seen in the picture) and I have tried doing GameStats.find({ game_id: gameId })

Submitted May 03, 2020 at 01:03AM by smallchimp

No comments:

Post a Comment