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
Passing "Human" as model name creates the collection as "Humen" #13037
Closed
2 tasks done
ahmetselimkaraca opened this issue
Feb 15, 2023
· 3 comments
· Fixed by vkarpov15/mongoose-legacy-pluralize#2
Closed
2 tasks done
Passing "Human" as model name creates the collection as "Humen" #13037
ahmetselimkaraca opened this issue
Feb 15, 2023
· 3 comments
· Fixed by vkarpov15/mongoose-legacy-pluralize#2
Labels
Milestone
Comments
Political Correct would be people. ;) |
IslandRhythms
added
the
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
label
Feb 15, 2023
const mongoose = require('mongoose');
const testSchema = new mongoose.Schema({
name: String
});
const Human = mongoose.model('Human', testSchema);
async function run() {
await mongoose.connect('mongodb://localhost:27017');
await mongoose.connection.dropDatabase();
const collections = mongoose.connection.collections;
Object.keys(collections).forEach(entry => {
console.log(entry);
console.log(mongoose.connection.collections[entry].name)
});
}
run(); |
We can only fix pluralization issues with major version bump. |
vkarpov15
added
backwards-breaking
and removed
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
labels
Feb 17, 2023
vkarpov15
added a commit
to vkarpov15/mongoose-legacy-pluralize
that referenced
this issue
Feb 17, 2023
vkarpov15
added a commit
to vkarpov15/mongoose-legacy-pluralize
that referenced
this issue
Feb 21, 2023
vkarpov15
added a commit
that referenced
this issue
Feb 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
I have searched existing issues to ensure the bug has not already been reported
I have written a descriptive issue title
Mongoose version
6.9.1
Node.js version
18.13.0
MongoDB server version
6.0.4
Typescript version (if applicable)
No response
Description
When pluralizing the collection name, mongoose sets it to "Humen". Plural for human is not humen, it's not a real word. The correct plural form is "Humans".
Steps to Reproduce
Simply naming passing "Human" to the model function results in this bug. (
const Human = mongoose.model("Human", humanSchema);
).Expected Behavior
Should be set to "Humans" instead.
The text was updated successfully, but these errors were encountered: