class_docstr: Converts query mongo to AST format
class_docstr_tok: ["Converts","query","mongo","to","AST","format"]
code: def handle_filter(self, value):
      ops = {
          "$ge": ">=",
          "$gt": ">",
          "$lt": "<",
          "$le": "<=",
          "$ne": "!=",
          "$eq": "=",
      }
      in_ops = {"$in": "in", "$nin": "not in"}
  
      if isinstance(value, dict):
          key, value = list(value.items())[0]
          if key in ops:
              op = ops[key]
              return op, value
  
          if key in in_ops:
              op = in_ops[key]
              if not isinstance(value, list):
                  raise NotImplementedError(
                      f"Unknown type {key}, {value}"
                  )
              value = Tuple(value)
  
              return op, value
  
          raise NotImplementedError(f"Unknown type {key}")
  
      elif isinstance(value, list):
          raise NotImplementedError(f"Unknown filter {value}")
      else:
          # is simple type
          op = "="
          value = value
          return op, value
  
file_path: mindsdb/mindsdb/api/mongo/utilities/mongodb_ast.py
imports: import re
  import ast
  import typing
  from mindsdb_sql.parser.ast import OrderBy, Identifier, Star, Select, Constant, BinaryOperation, Tuple, Latest
label_desc: Use image node_id 4 for calling the MongoToAst obj's underlying member method code with example usage: obj.handle_filter(value) and returns: op,  value, op,  value, op,  value