text: import nc from 'next-connect';
  import Product from '../../../models/Product';
  import db from '../../../utils/db';
  
  const handler = nc();
  
  handler.get(async (req, res) => {
    await db.connect();
    const topRatedProductsDocs = await Product.find({}, '-reviews')
      .lean()
      .sort({
        rating: -1,
      })
      .limit(6);
    await db.disconnect();
    res.send(topRatedProductsDocs);
  });
  
  export default handler;
  