-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
confirmed-bugWe've confirmed this is a bug in Mongoose and will fix it.We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Description
I ran into an issue today where sorting on an indexed field was hitting the 32MB MongoDB memory issue.
It turns out that defining new Schema({ ..., full_name: { index: true, type: String } }, { collation: { locale: 'en' } }); doesn't automatically set the collation option on the index for full_name.
I've fixed it manually by:
> db.users.dropIndex({ full_name: 1 });
{ "nIndexesWas" : 38, "ok" : 1 }
> db.users.ensureIndex({ full_name: 1 }, { collation: { locale: 'en' } });
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 37,
"numIndexesAfter" : 38,
"ok" : 1
}However if I migrate this to another server, Mongoose doesn't set this by default, so I'd have to re-run the above script.
Is there a way to set this as a global default if collation: ... option is passed to the schema for indices?
SteffenLanger, jeremyml and DmytroMysak
Metadata
Metadata
Assignees
Labels
confirmed-bugWe've confirmed this is a bug in Mongoose and will fix it.We've confirmed this is a bug in Mongoose and will fix it.