Parameters
  • err «Error|null» if set, will fail fast before sending the query to MongoDB
Returns:
  • «Query» this

Example:

Note that query casting runs after hooks, so cast errors will override custom errors.

Example:

  1. // `error` will be a cast error because `num` failed to cast