Describe the Bug
The getSimilarEventsBySlug() function appears to suffer from an N+1 query problem when fetching recommended events. Instead of retrieving similar events in a single optimized query, the implementation may perform multiple database calls, causing unnecessary overhead as the number of recommendations grows.
To Reproduce
- Open
event.actions.ts.
- Inspect the implementation of
getSimilarEventsBySlug().
- Observe that similar events are fetched through multiple database queries rather than a batched query.
- Note that the number of database calls increases with the number of recommended events.
Expected Behavior
Similar events should be fetched using a single optimized database query or aggregation pipeline to minimize database round trips and improve scalability.
Screenshots/Gifs
N/A
Environment (please complete the following information):
- OS: Windows
- Browser: Chrome
- Node Version: 20.x
Additional Context
This optimization would improve performance and reduce database load, especially when the number of similar events grows. A potential solution is to replace multiple individual queries with a batched query using $in or redesign the logic using a MongoDB aggregation pipeline.
I'd like to work on this issue and submit a fix.
Can you please assign me this issue for SSoc
Describe the Bug
The
getSimilarEventsBySlug()function appears to suffer from an N+1 query problem when fetching recommended events. Instead of retrieving similar events in a single optimized query, the implementation may perform multiple database calls, causing unnecessary overhead as the number of recommendations grows.To Reproduce
event.actions.ts.getSimilarEventsBySlug().Expected Behavior
Similar events should be fetched using a single optimized database query or aggregation pipeline to minimize database round trips and improve scalability.
Screenshots/Gifs
N/A
Environment (please complete the following information):
Additional Context
This optimization would improve performance and reduce database load, especially when the number of similar events grows. A potential solution is to replace multiple individual queries with a batched query using
$inor redesign the logic using a MongoDB aggregation pipeline.I'd like to work on this issue and submit a fix.
Can you please assign me this issue for SSoc