docs: function mergeOpObject(v1, v2) {
    const o = {};
  
    const o1 = isOpObject(v1) ? v1 : { $eq: v1 },
      o2 = isOpObject(v2) ? v2 : { $eq: v2 };
  
    //
    // Merge into single object
    //
  
    let nin;
    function addToNin(arr) {
      if (nin) {
        nin = union(nin, arr);
      } else {
        nin = arr;
      }
    }
  
    let and;
    function addToAnd(obj) {
      if (and) {
        and.push(obj);
      } else {
        and = [obj];
      }
    }
  
    for (const op in o1) {
      const v1 = o1[op],
        v2 = o2[op];
  
      if (v1 === undefined) {
        o[op] = v2;
      } else if (v2 === undefined) {
        o[op] = v1;
      } else {
        switch (op) {
          case '$in':
            validateInArray(v1);
            validateInArray(v2);
  
            const iarr = arrayIntersection(v1, v2);
            switch (iarr.length) {
              case 0:
                return false;
              default:
                o.$in = iarr;
            }
  
            break;
  
          case '$nin':
            validateInArray(v1);
            validateInArray(v2);
  
            const uarr = union(v1, v2);
            switch (uarr.length) {
              case 0:
                break;
              default:
                addToNin(uarr);
            }
  
            break;
  
          case '$eq':
            if (Tyr.isEqual(v1, v2)) {
              o.$eq = v1;
            } else {
              return false;
            }
  
            break;
  
          case '$ne':
            if (Tyr.isEqual(v1, v2)) {
              o.$ne = v1;
            } else {
              addToNin([v1, v2]);
            }
  
            break;
  
          case '$lt':
            o.$lt = Math.min(v1, v2);
            break;
  
          case '$ge':
            o.$ge = Math.max(v1, v2);
            break;
  
          case '$and':
            o.$and = v1.concat(v2);
            break;
  
          case '$or':
            addToAnd({ $or: v1 });
            addToAnd({ $or: v2 });
            break;
  
          default:
            throw new Error(`Unsupported operation "${op}" in query merging`);
        }
  
        if (!o) {
          return o;
        }
      }
    }
  
    for (const op in o2) {
      if (!o1[op]) {
        o[op] = o2[op];
      }
    }
  
    if (nin) {
      const onin = o.$nin;
      o.$nin = onin ? union(nin, onin) : nin;
    }
  
    if (and) {
      const oand = o.$and;
      o.$and = oand ? union(and, oand) : and;
    }
  
    return simplifyOpObject(o);
  }