Skip to content

Comments

Updated mongo queries to more efficient#643

Open
br648 wants to merge 3 commits intodevfrom
feature/DT-577-feed-source-summaries-mem-issue
Open

Updated mongo queries to more efficient#643
br648 wants to merge 3 commits intodevfrom
feature/DT-577-feed-source-summaries-mem-issue

Conversation

@br648
Copy link
Contributor

@br648 br648 commented Feb 19, 2026

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

Mongo query update to avoid memory issues.

Comment on lines 205 to 208
Aggregates.sort(Sorts.descending("version")),
Aggregates.limit(1),
// Project only the fields needed from the FeedVersion to reduce payload size.
Aggregates.project(fields(
Copy link
Contributor

@binh-dam-ibigroup binh-dam-ibigroup Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to prefix with Aggregates., you are already statically importing these operators (multiple instances).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: 89d283b


List<Bson> feedVersionPipeline = Arrays.asList(
match(expr(new Document("$in", Arrays.asList("$_id", "$$feedVersionIds")))),
project(fields(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For projections that only contain include, you can skip fields (5 instances)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: 89d283b

Copy link
Contributor

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, these are nice optimizations! I have suggested a few places to shorten the syntax.

Removed static prefixes and redundant field references
@br648 br648 assigned JymDyerIBI and unassigned br648 Feb 23, 2026
@br648 br648 requested a review from JymDyerIBI February 23, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants