function _cast(val, numbertype, context) {
  if (Array.isArray(val)) {
    val.forEach(function(item, i) {
      if (Array.isArray(item) || isObject(item)) {
        return _cast(item, numbertype, context);
      }
      val[i] = numbertype.castForQuery(null, item, context);
    });
  } else {
    const nearKeys = Object.keys(val);
    let nearLen = nearKeys.length;
    while (nearLen--) {
      const nkey = nearKeys[nearLen];
      const item = val[nkey];
      if (Array.isArray(item) || isObject(item)) {
        _cast(item, numbertype, context);
        val[nkey] = item;
      } else {
        val[nkey] = numbertype.castForQuery({ val: item, context: context });
      }
    }
  }
}
Handles internal casting for query filters.

@param {Schema} schema
@param {Object} obj Object to cast
@param {Object} [options] the query options
@param {Boolean|"throw"} [options.strict] Wheter to enable all strict options
@param {Boolean|"throw"} [options.strictQuery] Enable strict Queries
@param {Boolean} [options.sanitizeFilter] avoid adding implict query selectors ($in)
@param {Boolean} [options.upsert]
@param {Query} [context] passed to setters
@api private