class_docstr: This handler handles connection and execution of the MongoDB statements.
class_docstr_tok: ["This","handler","handles","connection","and","execution","of","the","MongoDB","statements","."]
docstr: Use first row to detect columns
docstr_tok: ["Use","first","row","to","detect","columns"]
code: def get_columns(self, collection) -> Response:
      """
      Use first row to detect columns
      """
      con = self.connect()
      record = con[self.database][collection].find_one()
  
      data = []
      if record is not None:
          record = self.flatten(record)
  
          for k, v in record.items():
              data.append([k, type(v).__name__])
  
      df = pd.DataFrame(data, columns=["Field", "Type"])
  
      response = Response(RESPONSE_TYPE.TABLE, df)
      return response
  
imports: import re
  import time
  from collections import OrderedDict
  from bson import ObjectId
  import certifi
  import pandas
  import pymongo
  from pymongo import MongoClient
  from mindsdb_sql.parser.ast.base import ASTNode
  from mindsdb.utilities import log
  from mindsdb.integrations.libs.base import DatabaseHandler
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse, RESPONSE_TYPE
  from .utils.mongodb_render import MongodbRender
  from mindsdb.api.mongo.utilities.mongodb_query import MongoQuery
  from mindsdb.api.mongo.utilities.mongodb_parser import MongodbParser
label_desc: Use image node_id 11 for calling the MongoDBHandler obj's underlying member method code with example usage: obj.get_columns(collection) and returns: response