[V3 Config] Update Mongo document organization to bypass doc size restriction #2536

Merged
tekulvw merged 16 commits from V3/mongo_overhaul into V3/develop 2019-04-03 15:04:48 +02:00
tekulvw commented 2019-03-31 06:08:32 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

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

  • The __init__ signature for Group and Value has changed in this PR.
  • The signature for driver.get(), driver.set(), and driver.clear() has also changed.
### Type - [ ] Bugfix - [x] Enhancement - [ ] New feature ### 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 * The `__init__` signature for Group and Value has changed in this PR. * The signature for `driver.get()`, `driver.set()`, and `driver.clear()` has also changed.
Tobotimus (Migrated from github.com) reviewed 2019-03-31 06:08:32 +02:00
mikeshardmind commented 2019-03-31 07:54:12 +02:00 (Migrated from github.com)

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:
image

The only correct result here is the one for past_nicks.

image

I'll look to see what else isn't working as intended with this later.

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: ![image](https://user-images.githubusercontent.com/22035876/55285330-97781400-5357-11e9-9615-882018a1d3c6.png) The only correct result here is the one for past_nicks. ![image](https://user-images.githubusercontent.com/22035876/55285338-c1313b00-5357-11e9-826f-4f354b900e95.png) I'll look to see what else isn't working as intended with this later.
Stonedestroyer commented 2019-03-31 17:17:53 +02:00 (Migrated from github.com)

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.

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.
Tobotimus commented 2019-04-01 02:33:07 +02:00 (Migrated from github.com)

@Stonedestroyer You can also simply make _id an object containing a single item with an array as a value, like so:
image

@Stonedestroyer You can also simply make `_id` an object containing a single item with an array as a value, like so: ![image](https://user-images.githubusercontent.com/7438501/55297453-e4500d80-5471-11e9-8ef7-5fb332b1f0a5.png)
tekulvw commented 2019-04-01 17:05:34 +02:00 (Migrated from github.com)

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".
image

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". ![image](https://user-images.githubusercontent.com/3731082/55338095-ed3ee000-546d-11e9-9e61-8bd412f62ab1.png)
mikeshardmind (Migrated from github.com) approved these changes 2019-04-02 23:26:00 +02:00
mikeshardmind (Migrated from github.com) left a comment

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).

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).
Kowlin (Migrated from github.com) approved these changes 2019-04-03 09:19:18 +02:00
Sign in to join this conversation.
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 milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!2536
No description provided.