docs: def _create(self, constraint, exists_main):
          """Create MongoDB query clause for a constraint.
  
          :param constraint: The constraint
          :type constraint: Constraint
          :param exists_main: Put exists into main clause
          :type exists_main: bool
          :return: New clause
          :rtype: MongoClause
          :raise: ValueError if value doesn't make sense for operator
          """
          c = constraint  # alias
          op = self._reverse_operator(c.op) if self._rev else c.op
          mop = self._mongo_op_str(op)
          # build the clause parts: location and expression
          loc = MongoClause.LOC_MAIN  # default location
          if op.is_exists():
              loc = MongoClause.LOC_MAIN2 if exists_main else MongoClause.LOC_MAIN
              assert (isinstance(c.value, bool))
              # for exists, reverse the value instead of the operator
              not_c_val = not c.value if self._rev else c.value
              expr = {c.field.name: {mop: not_c_val}}
          elif op.is_size():
              if op.is_variable():
                  # variables only support equality, and need to be in $where
                  loc = MongoClause.LOC_WHERE
                  js_op = '!=' if self._rev else '=='
                  expr = 'this.{}.length {} this.{}'.format(c.field.name, js_op, c.value)
              elif op.is_size_eq() and not self._rev:
                  expr = {c.field.name: {'$size': c.value}}
              else:
                  # inequalities also need to go into $where clause
                  self._check_size(op, c.value)
                  loc = MongoClause.LOC_WHERE
                  szop = ConstraintOperator(op.size_op)
                  if self._rev:
                      szop.reverse()
                  js_op = self._js_op_str(szop)
                  expr = 'this.{}.length {} {}'.format(c.field.name, js_op, c.value)
          elif op.is_type():
              loc = MongoClause.LOC_WHERE
              type_name = self.JS_TYPES.get(c.value, None)
              if type_name is None:
                  raise RuntimeError('Could not get JS type for {}'.format(c.value))
              typeop = '!=' if self._rev else '=='
              expr = 'typeof this.{} {} "{}"'.format(c.field.name, typeop, type_name)
          elif op.is_regex():
              expr = {c.field.name: {mop: c.value.pattern}}
          else:
              if mop is None:
                  expr = {c.field.name: c.value}
              elif isinstance(c.value, bool):
                  # can simplify boolean {a: {'$ne': True/False}} to {a: False/True}
                  not_c_val = not c.value if self._rev else c.value
                  expr = {c.field.name: not_c_val}
              else:
                  expr = {c.field.name: {mop: c.value}}
          return loc, expr