javascript – node js $strLenCP requires a string argument, found: missing’,

router.get("/find", async function (req, res) {
  // var regex = new RegExp("react", "i");
  var date1 = new Date("2024-08-22");
  var date2 = new Date("2024-08-23");
  let userData = await userModel.find({
    $expr: {
      $and: [
        { $gte: [{ $strLenCP: "$name" }, 0] },
        { $lte: [{ $strLenCP: "$name" }, 30] },
      ],
    },
  });
  res.send(userData);
});
});

why showing error this starlamcp is a string why it show why it showing

$strLenCP requires a string argument, found: missing’,

Read more here: Source link