[V3 Config] Update Mongo document organization to bypass doc size restriction #2536
No reviewers
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!2536
Loading…
Reference in a new issue
No description provided.
Delete branch "V3/mongo_overhaul"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Description of the changes
This PR reorganizes how the Mongo driver stores data on the database. It will create many more documents than the current implementation but they will each be significantly smaller than the current documents. Because of this reorganization, any existing Mongo data will not be readable by this PR and will need to be migrated using a future tool.
Warning: Breaking Changes
__init__signature for Group and Value has changed in this PR.driver.get(),driver.set(), anddriver.clear()has also changed.This breaks on at least the all_x methods, as well as on group all methods
From a quick test with a new bot on an isolated server:

The only correct result here is the one for past_nicks.
I'll look to see what else isn't working as intended with this later.
As discussed on red discord server apparently we can't use _id due to the fact that it can't be an array. This is an alternative. https://docs.mongodb.com/master/core/index-unique/
It would help making mongo faster than json, i think next step would allowing cog developers to define unique indexes for their own cogs.
@Stonedestroyer You can also simply make

_idan object containing a single item with an array as a value, like so:The latest commit changes the layout of the collection/document structure to follow the format in the image below. There will be a single database for the bot, a collection for each combination of "Cog.CATEGORY" and a document for each unique dataset in "Cog.CATEGORY".

This seems ready to go now.
This is a breaking change. This does remove the ability to convert backend right now (which needs to go onto the 3.1 todo list (updating the conversion for the new organization).