Controller 

The listByMaker controller method will query the Game collection in the database to get the matching games.

mern-vrgame/server/controllers/game.controller.js:

const listByMaker = (req, res) => {  Game.find({maker: req.profile._id}, (err, games) => {    if(err) {      return res.status(400).json({        error: errorHandler.getErrorMessage(err)      })    }    res.json(games)  }).populate('maker', '_id name')}

In the query to the Game collection, we find all the games where the maker field matches the user specified in req.profile.

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.