// @route GET /api/products/top
// @desc Get top rated products
// @access Public
router.get(
'/top',
asyncHandler(async (req, res) => {
const products = await Product.find({}).sort({ rating: -1 }).limit(3)
res.json(products)
})
)
Cast to ObjectId failed for value “top” (type string) at path “_id” for model “Product”
[enter image description here][1]