prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  KeyError: 'mongodb' on start
  Starting Mindsdb(python -m mindsdb) version 2.8.1 throws:
  
  ```
  Failed to start mongodb API with exception 'mongodb'
  Traceback (most recent call last):
    File "/home/zoran/MyProjects/mindsdb-examples/mdb/lib/python3.7/site-packages/mindsdb/__main__.py", line 83, in <module>
      p = ctx.Process(target=start_functions[api], args=(config_path, True,))
  KeyError: 'mongodb'
  
  Traceback (most recent call last):
    File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
      exec(code, run_globals)
    File "/home/zoran/MyProjects/mindsdb-examples/mdb/lib/python3.7/site-packages/mindsdb/__main__.py", line 83, in <module>
      p = ctx.Process(target=start_functions[api], args=(config_path, True,))
  KeyError: 'mongodb'
  ```
  
  </issue>
  <code>
  [start of mindsdb/__main__.py]
  1 import atexit
  2 import traceback
  3 import sys
  4 import os
  5 
  6 import torch.multiprocessing as mp
  7 
  8 from mindsdb_native.config import CONFIG
  9 
  10 from mindsdb.utilities.config import Config
  11 from mindsdb.interfaces.native.mindsdb import MindsdbNative
  12 from mindsdb.interfaces.custom.custom_models import CustomModels
  13 from mindsdb.api.http.start import start as start_http
  14 from mindsdb.api.mysql.start import start as start_mysql
  15 from mindsdb.api.mongo.start import start as start_mongo
  16 from mindsdb.utilities.fs import get_or_create_dir_struct
  17 from mindsdb.interfaces.database.database import DatabaseWrapper
  18 from mindsdb.utilities.functions import args_parse
  19 
  20 
  21 def close_api_gracefully(p_arr):
  22     for p in p_arr:
  23         sys.stdout.flush()
  24         p.terminate()
  25         p.join()
  26         sys.stdout.flush()
  27 
  28 
  29 if __name__ == '__main__':
  30     mp.freeze_support()
  31 
  32     args = args_parse()
  33 
  34     config_path = args.config
  35     if config_path is None:
  36         config_dir, _ = get_or_create_dir_struct()
  37         config_path = os.path.join(config_dir, 'config.json')
  38 
  39     print(f'Using configuration file: {config_path}')
  40     config = Config(config_path)
  41 
  42     if args.api is None:
  43         api_arr = [api for api in config['api']]
  44     else:
  45         api_arr = args.api.split(',')
  46 
  47     start_functions = {
  48         'http': start_http,
  49         'mysql': start_mysql,
  50         'mongo': start_mongo
  51     }
  52 
  53     mdb = MindsdbNative(config)
  54     cst = CustomModels(config)
  55     # @TODO Maybe just use `get_model_data` directly here ? Seems like a useless abstraction
  56     model_data_arr = [
  57         {
  58             'name': x['name'],
  59             'predict': x['predict'],
  60             'data_analysis': mdb.get_model_data(x['name'])['data_analysis_v2']
  61         } for x in mdb.get_models()
  62     ]
  63 
  64     for m in model_data_arr:
  65         if 'columns_to_ignore' in m['data_analysis']:
  66             del m['data_analysis']['columns_to_ignore']
  67         if 'train_std_dev' in m['data_analysis']:
  68             del m['data_analysis']['train_std_dev']
  69 
  70     model_data_arr.extend(cst.get_models())
  71 
  72     dbw = DatabaseWrapper(config)
  73     dbw.register_predictors(model_data_arr)
  74 
  75     for broken_name in [name for name, connected in dbw.check_connections().items() if connected is False]:
  76         print(f'Error failed to integrate with database aliased: {broken_name}')
  77 
  78     p_arr = []
  79     ctx = mp.get_context('spawn')
  80     for api in api_arr:
  81         print(f'Starting Mindsdb {api} API !')
  82         try:
  83             p = ctx.Process(target=start_functions[api], args=(config_path, True,))
  84             p.start()
  85             p_arr.append(p)
  86             print(f'Started Mindsdb {api} API !')
  87         except Exception as e:
  88             close_api_gracefully(p_arr)
  89             print(f'Failed to start {api} API with exception {e}')
  90             print(traceback.format_exc())
  91             raise
  92 
  93     atexit.register(close_api_gracefully, p_arr=p_arr)
  94 
  95     for p in p_arr:
  96         p.join()
  97
  [end of mindsdb/__main__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/mindsdb/__main__.py b/mindsdb/__main__.py
  --- a/mindsdb/__main__.py
  +++ b/mindsdb/__main__.py
  @@ -40,14 +40,20 @@
       config = Config(config_path)
   
       if args.api is None:
  -        api_arr = [api for api in config['api']]
  +        api_arr = ['http', 'mysql']
       else:
           api_arr = args.api.split(',')
   
  +    for api in api_arr:
  +        if api not in config:
  +            print(f"Trying run '{api}' API, but is no config for this api.")
  +            print(f"Please, fill config['api']['{api}']")
  +            sys.exit(0)
  +
       start_functions = {
           'http': start_http,
           'mysql': start_mysql,
  -        'mongo': start_mongo
  +        'mongodb': start_mongo
       }
   
       mdb = MindsdbNative(config)
  
verification_info: {"golden_diff": "diff --git a/mindsdb/__main__.py b/mindsdb/__main__.py\n--- a/mindsdb/__main__.py\n+++ b/mindsdb/__main__.py\n@@ -40,14 +40,20 @@\n     config = Config(config_path)\n \n     if args.api is None:\n-        api_arr = [api for api in config['api']]\n+        api_arr = ['http', 'mysql']\n     else:\n         api_arr = args.api.split(',')\n \n+    for api in api_arr:\n+        if api not in config:\n+            print(f\"Trying run '{api}' API, but is no config for this api.\")\n+            print(f\"Please, fill config['api']['{api}']\")\n+            sys.exit(0)\n+\n     start_functions = {\n         'http': start_http,\n         'mysql': start_mysql,\n-        'mongo': start_mongo\n+        'mongodb': start_mongo\n     }\n \n     mdb = MindsdbNative(config)\n", "issue": "KeyError: 'mongodb' on start\nStarting Mindsdb(python -m mindsdb) version 2.8.1 throws:\r\n\r\n```\r\nFailed to start mongodb API with exception 'mongodb'\r\nTraceback (most recent call last):\r\n  File \"/home/zoran/MyProjects/mindsdb-examples/mdb/lib/python3.7/site-packages/mindsdb/__main__.py\", line 83, in <module>\r\n    p = ctx.Process(target=start_functions[api], args=(config_path, True,))\r\nKeyError: 'mongodb'\r\n\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python3.7/runpy.py\", line 193, in _run_module_as_main\r\n    \"__main__\", mod_spec)\r\n  File \"/usr/local/lib/python3.7/runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/home/zoran/MyProjects/mindsdb-examples/mdb/lib/python3.7/site-packages/mindsdb/__main__.py\", line 83, in <module>\r\n    p = ctx.Process(target=start_functions[api], args=(config_path, True,))\r\nKeyError: 'mongodb'\r\n```\n", "before_files": [{"content": "import atexit\nimport traceback\nimport sys\nimport os\n\nimport torch.multiprocessing as mp\n\nfrom mindsdb_native.config import CONFIG\n\nfrom mindsdb.utilities.config import Config\nfrom mindsdb.interfaces.native.mindsdb import MindsdbNative\nfrom mindsdb.interfaces.custom.custom_models import CustomModels\nfrom mindsdb.api.http.start import start as start_http\nfrom mindsdb.api.mysql.start import start as start_mysql\nfrom mindsdb.api.mongo.start import start as start_mongo\nfrom mindsdb.utilities.fs import get_or_create_dir_struct\nfrom mindsdb.interfaces.database.database import DatabaseWrapper\nfrom mindsdb.utilities.functions import args_parse\n\n\ndef close_api_gracefully(p_arr):\n    for p in p_arr:\n        sys.stdout.flush()\n        p.terminate()\n        p.join()\n        sys.stdout.flush()\n\n\nif __name__ == '__main__':\n    mp.freeze_support()\n\n    args = args_parse()\n\n    config_path = args.config\n    if config_path is None:\n        config_dir, _ = get_or_create_dir_struct()\n        config_path = os.path.join(config_dir, 'config.json')\n\n    print(f'Using configuration file: {config_path}')\n    config = Config(config_path)\n\n    if args.api is None:\n        api_arr = [api for api in config['api']]\n    else:\n        api_arr = args.api.split(',')\n\n    start_functions = {\n        'http': start_http,\n        'mysql': start_mysql,\n        'mongo': start_mongo\n    }\n\n    mdb = MindsdbNative(config)\n    cst = CustomModels(config)\n    # @TODO Maybe just use `get_model_data` directly here ? Seems like a useless abstraction\n    model_data_arr = [\n        {\n            'name': x['name'],\n            'predict': x['predict'],\n            'data_analysis': mdb.get_model_data(x['name'])['data_analysis_v2']\n        } for x in mdb.get_models()\n    ]\n\n    for m in model_data_arr:\n        if 'columns_to_ignore' in m['data_analysis']:\n            del m['data_analysis']['columns_to_ignore']\n        if 'train_std_dev' in m['data_analysis']:\n            del m['data_analysis']['train_std_dev']\n\n    model_data_arr.extend(cst.get_models())\n\n    dbw = DatabaseWrapper(config)\n    dbw.register_predictors(model_data_arr)\n\n    for broken_name in [name for name, connected in dbw.check_connections().items() if connected is False]:\n        print(f'Error failed to integrate with database aliased: {broken_name}')\n\n    p_arr = []\n    ctx = mp.get_context('spawn')\n    for api in api_arr:\n        print(f'Starting Mindsdb {api} API !')\n        try:\n            p = ctx.Process(target=start_functions[api], args=(config_path, True,))\n            p.start()\n            p_arr.append(p)\n            print(f'Started Mindsdb {api} API !')\n        except Exception as e:\n            close_api_gracefully(p_arr)\n            print(f'Failed to start {api} API with exception {e}')\n            print(traceback.format_exc())\n            raise\n\n    atexit.register(close_api_gracefully, p_arr=p_arr)\n\n    for p in p_arr:\n        p.join()\n", "path": "mindsdb/__main__.py"}]}