Skip to content

Create Accont index to optimize queries on list endpoint#12

Merged
Kmario19 merged 2 commits intomainfrom
chore/psfb
Apr 3, 2025
Merged

Create Accont index to optimize queries on list endpoint#12
Kmario19 merged 2 commits intomainfrom
chore/psfb

Conversation

@Kmario19
Copy link
Copy Markdown
Owner

@Kmario19 Kmario19 commented Apr 3, 2025

This pull request includes changes to improve the security of environment variables and enhance the performance of database queries. The most important changes include updating the MongoDB URI to use placeholders for sensitive information and adding an index to the Account schema to optimize query performance.

Security improvements:

  • .env.example: Updated the MONGODB_URI to use placeholders for the username and password to avoid hardcoding sensitive information.

Database performance enhancements:

  • src/models/Account.ts: Added an index to the Account schema to improve the performance of queries involving the name, balance, and createdAt fields.

Copilot AI review requested due to automatic review settings April 3, 2025 14:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request improves database query performance by adding a compound index to the Account schema and enhances security by updating the MongoDB URI placeholders in configuration.

  • Updated the MongoDB URI to replace hardcoded credentials with placeholders.
  • Added a compound index in the Account model on name, balance, and createdAt fields.
Files not reviewed (1)
  • .env.example: Language not supported
Comments suppressed due to low confidence (1)

src/models/Account.ts:35

  • [nitpick] Verify that the descending order for the 'createdAt' field (-1) aligns with the query patterns. If queries require ascending order, update the index accordingly.
accountSchema.index({ name: 1, balance: 1, createdAt: -1 });

@Kmario19 Kmario19 merged commit 37b38fd into main Apr 3, 2025
1 check passed
@Kmario19 Kmario19 deleted the chore/psfb branch April 3, 2025 14:08
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.

2 participants