code: def _insert_database(self, query, request_env, mindsdb_env):
      for doc in query["documents"]:
          if "_id" in doc:
              del doc["_id"]
          for field in ("name", "engine", "connection_args"):
              if field not in doc:
                  raise Exception(f"'{field}' must be specified")
  
          status = HandlerStatusResponse(success=False)
          try:
              handler = mindsdb_env[
                  "integration_controller"
              ].create_tmp_handler(
                  handler_type=doc["engine"],
                  connection_data=doc["connection_args"],
              )
              status = handler.check_connection()
          except Exception as e:
              status.error_message = str(e)
  
          if status.success is False:
              raise Exception(
                  f"Can't connect to db: {status.error_message}"
              )
  
          integration = mindsdb_env["integration_controller"].get(
              doc["name"]
          )
          if integration is not None:
              raise Exception(
                  f"Database '{doc['name']}' already exists."
              )
  
      for doc in query["documents"]:
          mindsdb_env["integration_controller"].add(
              doc["name"], doc["engine"], doc["connection_args"]
          )
  
file_path: mindsdb/mindsdb/api/mongo/responders/insert.py
imports: import pandas
  from mindsdb_sql.parser.ast import Constant, Identifier, Insert, OrderBy, TableColumn
  from mindsdb_sql.parser.dialects.mindsdb import CreateJob, CreateMLEngine, CreatePredictor, FinetunePredictor, RetrainPredictor
  import mindsdb.api.mongo.functions
  from mindsdb.api.mongo.classes import Responder
  from mindsdb.api.mongo.classes.query_sql import run_sql_command
  from mindsdb.api.mongo.responders.aggregate import aggregate_to_ast
  from mindsdb.api.mongo.responders.find import find_to_ast
  from mindsdb.api.mongo.utilities.mongodb_parser import MongodbParser
  from mindsdb.integrations.libs.response import HandlerStatusResponse
  from mindsdb.utilities import log
label_desc: Use image node_id 2 for calling the Responce obj's underlying member method code with example usage: obj._insert_database(query, request_env, mindsdb_env) without return types