code: def handle_where(self, node):
      # todo UnaryOperation, function
      if not type(node) in [BinaryOperation]:
          raise NotImplementedError(f"Not supported type {type(node)}")
  
      # logic operation
      op = node.op.lower()
      arg1, arg2 = node.args
  
      if op in ("and", "or"):
          query1 = self.handle_where(arg1)
          query2 = self.handle_where(arg2)
  
          ops = {
              "and": "$and",
              "or": "$or",
          }
          query = {ops[op]: [query1, query2]}
          return query
  
      ops_map = {
          ">=": "$gte",
          ">": "$gt",
          "<": "$lt",
          "<=": "$lte",
          "<>": "$ne",
          "!=": "$ne",
          "=": "$eq",
          "==": "$eq",
          "is": "$eq",
          "is not": "$ne",
      }
  
      if isinstance(arg1, Identifier):
          var_name = arg1.parts[-1]
          # is simple operation
          if isinstance(arg2, Constant):
              # identifier and constant
  
              val = arg2.value
              if op in ("=", "=="):
                  pass
              elif op in ops_map:
                  op2 = ops_map[op]
                  val = {op2: val}
              else:
                  raise NotImplementedError(
                      f"Not supported operator {op}"
                  )
  
              return {var_name: val}
  
          # is IN condition
          elif isinstance(arg2, Tuple):
              # it should be IN, NOT IN
              ops = {"in": "$in", "not in": "$nin"}
              # must be list of Constants
              values = [i.value for i in arg2.items]
  
              if op in ops:
                  op2 = ops[op]
                  cond = {op2: values}
              else:
                  raise NotImplementedError(
                      f"Not supported operator {op}"
                  )
  
              return {var_name: cond}
  
      # try to make expression
  
      val1 = self.where_element_convert(arg1)
      val2 = self.where_element_convert(arg2)
  
      if op in ops_map:
          op2 = ops_map[op]
      else:
          raise NotImplementedError(f"Not supported operator {op}")
  
      return {"$expr": {op2: [val1, val2]}}
  
file_path: mindsdb/mindsdb/integrations/handlers/mongodb_handler/utils/mongodb_render.py
imports: import datetime
  from mindsdb_sql.parser.ast import *
  from mindsdb.api.mongo.utilities.mongodb_query import MongoQuery
label_desc: Use image node_id 4 for calling the MongodbRender obj's underlying member method code with example usage: obj.handle_where(node) and returns: dict, query, dict, dict