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
I have searched existing issues to ensure the bug has not already been reported
Mongoose version
8.7.2
Node.js version
22.0
MongoDB server version
7.0
Typescript version (if applicable)
No response
Description
Time Series a little bit tricky on MongoDB. They are "MongoDB automatically creates a compound index on both the metaField and timeField of a time series collection." https://www.mongodb.com/docs/manual/core/timeseries-collections/#indexes
Mongoose diffIndexes have no aware of it and propose to delete this index. I suppose it is really expected behaviour as mongoose sync indexes between schema and database (with _id index exception)
Prerequisites
Mongoose version
8.7.2
Node.js version
22.0
MongoDB server version
7.0
Typescript version (if applicable)
No response
Description
Time Series a little bit tricky on MongoDB. They are "MongoDB automatically creates a compound index on both the metaField and timeField of a time series collection." https://www.mongodb.com/docs/manual/core/timeseries-collections/#indexes
Mongoose diffIndexes have no aware of it and propose to delete this index. I suppose it is really expected behaviour as mongoose sync indexes between schema and database (with _id index exception)
Steps to Reproduce
This will make an index on mongoDB
Now
Expected Behavior
In ideal scenario Mongoose should understand time series index and skip it. But this index can be changes from version to version (looks like it introduced from mongo v6.3, but time series from mongo v5 https://www.mongodb.com/docs/manual/core/timeseries-collections/#benefits).
At least will be good to add note to documentation and/or warn about time series collection and required flag to work on it
But in a general MongoDB can introduce auto indexes for other collection too and somehow mongoose should understand it
The text was updated successfully, but these errors were encountered: