0

I have a user model like so

requestCashout: {
  amount: {
    type: Number,
    default: 0
  }
}

I want to get all the users which has amount of greater than 0, I did this

exports.getUsersRequestCashout = async function(req, res, next) {
  const users = await User.find(
    { role: 'member', {'requestCashout.amount': $gt: 0} },
    {
      fullName: 1,
      requestCashout: 1
    }
  ).exec()

  res.json({
    status: 1,
    data: users
  })
}

Why requestCashout.amount doesn't seem valid?

Yunyi Chang
  • 159
  • 1
  • 12

0 Answers0