code: def select(self, node: Select):
      # collection
      if not isinstance(node.from_table, Identifier):
          raise NotImplementedError(
              f"Not supported from {node.from_table}"
          )
  
      collection = node.from_table.parts[-1]
  
      # filter
      filters = {}
  
      if node.where is not None:
          filters = self.handle_where(node.where)
  
      group = {}
      project = {"_id": 0}  # hide _id
      if node.distinct:
          # is group by distinct fields
          group = {"_id": {}}
  
      if node.targets is not None:
          for col in node.targets:
              if isinstance(col, Star):
                  # show all
                  project = {}
                  break
              if isinstance(col, Identifier):
                  name = col.parts[-1]
                  if col.alias is None:
                      alias = name
                  else:
                      alias = col.alias.parts[-1]
  
                  project[alias] = f"${name}"  # project field
  
                  # group by distinct fields
                  if node.distinct:
                      group["_id"][name] = f"${name}"  # group field
                      group[name] = {"$first": f"${name}"}  # show field
  
              elif isinstance(col, Constant):
                  val = str(
                      col.value
                  )  # str because int is interpreted as index
                  if col.alias is None:
                      alias = val
                  else:
                      alias = col.alias.parts[-1]
                  project[alias] = val
  
      if node.group_by is not None:
          # TODO
          raise NotImplementedError(f"Group {node.group_by}")
  
      sort = {}
      if node.order_by is not None:
          for col in node.order_by:
              name = col.field.parts[-1]
              direction = 1 if col.direction.upper() == "ASC" else -1
              sort[name] = direction
  
      # compose mongo query
  
      mquery = MongoQuery(collection)
  
      method = "aggregate"
      arg = []
  
      # mongodb related pipeline steps for aggregate method
      if node.modifiers is not None:
          for modifier in node.modifiers:
              arg.append(modifier)
  
      if filters:
          arg.append({"$match": filters})
  
      if group:
          arg.append({"$group": group})
  
      if project:
          arg.append({"$project": project})
  
      if sort:
          arg.append({"$sort": sort})
  
      if node.offset is not None:
          arg.append({"$skip": int(node.offset.value)})
  
      if node.limit is not None:
          arg.append({"$limit": int(node.limit.value)})
  
      mquery.add_step({"method": method, "args": [arg]})
  
      return mquery
  
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 3 for calling the MongodbRender obj's underlying member method code with example usage: obj.select(node) and returns: mquery