You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Setting autoSearchIndex to true dont create search index #15565
I have searched existing issues to ensure the bug has not already been reported
Mongoose version
8.17.0
Node.js version
24.3.0
MongoDB server version
6.x
Typescript version (if applicable)
5.9.2
Description
Setting autoSearchIndex to true do not create search index
calling init() on model throws error that this.ensureSearchIndexes is not a function
the only way to create search index now is to await on createSearchIndexes() on model
Steps to Reproduce
1097 | );
1098 | if (!autoSearchIndex) {
1099 | return;
1100 | }
1101 |
1102 | return await this.ensureSearchIndexes();
^
TypeError: this.ensureSearchIndexes is not a function. (In 'this.ensureSearchIndexes()', 'this.ensureSearchIndexes' is undefined)
at <anonymous> (/usr/src/app/node_modules/mongoose/lib/model.js:1102:23)
at _createSearchIndexes (/usr/src/app/node_modules/mongoose/lib/model.js:1091:32)
Activity
fix(model): call correct function in autoSearchIndex
Merge pull request #15569 from Automattic/vkarpov15/gh-15565