Skip to content
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

autoIndex does not use Schema collation to create index #9912

Closed
jeremyml opened this issue Feb 10, 2021 · 0 comments
Closed

autoIndex does not use Schema collation to create index #9912

jeremyml opened this issue Feb 10, 2021 · 0 comments
Assignees
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Milestone

Comments

@jeremyml
Copy link

jeremyml commented Feb 10, 2021

var UserSchema = mongoose.Schema({
  firstName: {type: String, index: true}
},{autoIndex : true, collation: { locale: 'en' }});

db.user.getIndexes();

    {
        "v" : 2,
        "key" : {
            "firstName" : 1
        },
        "name" : "firstName_1",
        "ns" : "db.user",
        "background" : true
    },

There is no en collation on the index created by autoIndex . I may write a startup script to perform the autoIndex function with the collation options set on the Schema. Mongoose ignores the Schema collation when autoIndex creates an index (uses collection default collation instead).

Seems related to this other issue: #7621

@jeremyml jeremyml changed the title autoindex does not use Schema collation to create index autoIndex does not use Schema collation to create index Feb 10, 2021
@vkarpov15 vkarpov15 added this to the 5.11.17 milestone Feb 12, 2021
vkarpov15 added a commit that referenced this issue Feb 13, 2021
@vkarpov15 vkarpov15 added the confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. label Feb 13, 2021
This was referenced Mar 5, 2021
This was referenced Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Projects
None yet
Development

No branches or pull requests

2 participants