Skip to content

fix: include options parameter in createIndex method #794

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

Merged
merged 1 commit into from
Jul 28, 2025

Conversation

digorgonzola
Copy link
Contributor

@digorgonzola digorgonzola commented Jul 1, 2025

Problem: When defining custom index names in model settings, the connector was ignoring the specified name option and falling back to MongoDB's default naming convention (e.g., "archived_1" instead of "archived").

Root Cause: The createIndex() call was missing the options parameter, so custom index options including the name field were not being passed to MongoDB.

Solution: Updated the createIndex() call to include the index.options parameter:

Checklist

  • DCO (Developer Certificate of Origin) signed in all commits
  • npm test passes on your machine (fails 1 test but this is unrelated)
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • Commit messages are following our guidelines

@rahulrkr08
Copy link

Adding +1 for this. xxx-alpha.5 version is breaking migration (index creation).

@dhmlau dhmlau merged commit c6ce263 into loopbackio:master Jul 28, 2025
6 of 15 checks passed
@dhmlau
Copy link
Member

dhmlau commented Jul 28, 2025

@digorgonzola, thanks for your contribution. Your PR has landed! 🎉

@digorgonzola digorgonzola deleted the fix/pass-index-options branch July 29, 2025 23:26
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