Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
MongoDB/node.js - How to find all movies of the same genre by "Name"?

I am building a 'netflix' style app for practice. In it, I want the user to be able to find all movies of a certain genre by typing in the following url:

http://localhost:8080/movies/Adventure

But I seem to be going wrong somewhere, because the list returns null... here is my code:

app.get('/movies/:genre', (req, res) => {
                Movies.find({ 
                    Genre: { Name: req.params.genre } 
                  }).populate('Genre Director Actors')
                  .then((movie) => {
                    res.json(movie);
                  }).catch((err) => {
                    console.error(err);
                    res.status(500).send('Error: ' + err);
                  });
                });

and this is the data from MongoDB:

"Genre": [
{
"_id": "611b4b465bf9b8645dd32ef9",
"Name": "Animated",
"Description": "Animation is a method in which pictures are manipulated to appear as moving images. In traditional animation, images are drawn or painted by hand on transparent celluloid sheets to be photographed and exhibited on film."
}
],
"Actors": [
{
"_id": "611bd09659f7b8323ad90441",
"Name": "Johnny Depp",
"Bio": "John Christopher Depp II is an American actor, producer, and musician. He is the recipient of various accolades, including a Golden Globe Award and a Screen Actors Guild Award, in addition to nominations for three Academy Awards and two British Academy Film Awards.",
"Birth": "1963-06-09",
"Death": "N/A"
}
],
"_id": "611c06f4cb359ae2b8220245",
"Title": "Rango",
"Description": "A chameleon (Johnny Depp) who has lived as a sheltered family pet finds himself in the grip of an identity crisis. Rango wonders how to stand out when it is his nature to blend in. When he accidentally winds up in a frontier town called Dirt, he takes the first step on a transformational journey as the town's new sheriff. Though at first Rango only role-plays, a series of thrilling situations and outrageous encounters forces him to become a real hero.",
"Director": {
"_id": "611b4f835bf9b8645dd32efe",
"Name": "Gore Verbinski",
"Bio": "Gregor Justin 'Gore' Verbinski is an American film director, screenwriter, producer, and musician. He is best known for directing The Ring, the Pirates of the Caribbean films, and Rango.",
"Birth": "1964-03-16",
"Death": "N/A"
},
"ImagePath": "rango.png",
"Featured": false
}

All help is appreciated!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Movies.find({ "Genre.Name": req.params.genre })
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda