Skip to content
Browse files

Remove the mongo driver (#3099)

* kills mongo

* changelog

* more refeences to mongo needed to go
  • Loading branch information
mikeshardmind committed Nov 8, 2019
1 parent 1651de1 commit dd899c804acfc9941ac8cc2285ed3bfb31f8490b
@@ -14,4 +14,3 @@ python:
path: .
- docs
- mongo
@@ -27,10 +27,6 @@ jobs:
postgresql: "10"
- psql -c 'create database red_db;' -U postgres
- env: TOXENV=mongo
services: mongodb
- mongo red_db --eval 'db.createUser({user:"red",pwd:"red",roles:["readWrite"]});'
# These jobs only occur on tag creation if the prior ones succeed
- stage: PyPi Deployment
if: tag IS present
@@ -0,0 +1 @@
Removes the mongo driver.
@@ -429,7 +429,3 @@ JSON Driver
.. autoclass:: redbot.core.drivers.JsonDriver

Mongo Driver
.. autoclass:: redbot.core.drivers.MongoDriver
@@ -265,18 +265,12 @@ Choose one of the following commands to install Red.

python3.7 -m pip install --user -U Red-DiscordBot

To install without MongoDB support:
To install without additional config backend support:

.. code-block:: none

python3.7 -m pip install -U Red-DiscordBot

Or, to install with MongoDB support:

.. code-block:: none

python3.7 -m pip install -U Red-DiscordBot[mongo]

Or, to install with PostgreSQL support:

.. code-block:: none
@@ -76,12 +76,6 @@ Installing Red

python -m pip install -U Red-DiscordBot

* With MongoDB support:

.. code-block:: none

python -m pip install -U Red-DiscordBot[mongo]

* With PostgreSQL support:

.. code-block:: none
@@ -4,7 +4,6 @@
from .. import data_manager
from .base import IdentifierData, BaseDriver, ConfigCategory
from .json import JsonDriver
from .mongo import MongoDriver
from .postgres import PostgresDriver

__all__ = [
@@ -13,24 +12,20 @@

class BackendType(enum.Enum):
MONGO = "MongoDBV2"
MONGOV1 = "MongoDB"
POSTGRES = "Postgres"
# Dead drivrs below retained for error handling.
MONGOV1 = "MongoDB"
MONGO = "MongoDBV2"

BackendType.JSON: JsonDriver,
BackendType.MONGO: MongoDriver,
BackendType.POSTGRES: PostgresDriver,
_DRIVER_CLASSES = {BackendType.JSON: JsonDriver, BackendType.POSTGRES: PostgresDriver}

def get_driver_class(storage_type: Optional[BackendType] = None) -> Type[BaseDriver]:
@@ -86,7 +81,7 @@ def get_driver(
If the storage type is MongoV1 or invalid.
If the storage type is MongoV1, Mongo, or invalid.
if storage_type is None:
@@ -98,12 +93,10 @@ def get_driver(
driver_cls: Type[BaseDriver] = get_driver_class(storage_type)
except ValueError:
if storage_type == BackendType.MONGOV1:
if storage_type in (BackendType.MONGOV1, BackendType.MONGO):
raise RuntimeError(
"Please convert to JSON first to continue using the bot."
" This is a required conversion prior to using the new Mongo driver."
" This message will be updated with a link to the update docs once those"
" docs have been created."
"Mongo support was removed in 3.2."
) from None
raise RuntimeError(f"Invalid driver type: '{storage_type}'") from None
@@ -221,7 +221,7 @@ def _save_json(path: Path, data: Dict[str, Any]) -> None:
On windows, it is not available in entirety.
If a windows user ends up with tons of temp files, they should consider hosting on
something POSIX compatible, or using the mongo backend instead.
something POSIX compatible, or using a different backend instead.
Most users wont encounter this issue, but with high write volumes,
without the fsync on both the temp file, and after the replace on the directory,

0 comments on commit dd899c8

Please sign in to comment.
You can’t perform that action at this time.