Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongo breadcrumb: Summarize the length of long arrays #799

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

johnnyshields
Copy link
Contributor

@johnnyshields johnnyshields commented Oct 19, 2023

Goal

In Mongo queries, it is very common to set a filter with "$in": [ some long array ] to avoid N+1 queries. Here's how this looks in the breadcrumb:
image

This is a problem because:

  1. Its a ton of text
  2. It's difficult to know how many members the array actually has.

Design

To fix this, in the Mongo filter field, an Array which (a) has more than 3 members and (b) does not contain nested Arrays or Hashes will be summarized as ["LENGTH=42"] (e.g. if it has 42 members)

Changeset

Only changes the Mongo breadcrumb functionality.

This also includes the changes from:

Testing

Tested in RSpec and by TableCheck in production.

@johnnyshields johnnyshields changed the title Mongo filter array length Mongo breadcrumb: Summarize the length of long arrays Oct 19, 2023
@clr182
Copy link

clr182 commented Oct 19, 2023

Hi @johnnyshields
Thanks for raising this PR. We will be sure to take a look when priority allows us.

@clr182 clr182 added feature request Request for a new feature backlog We hope to fix this feature/bug in the future labels Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We hope to fix this feature/bug in the future feature request Request for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants