Why does the mongoose always add an s to the end of the name of my collection?

advertisements

For example, this code results in a collection called "datas" being created

var Dataset = mongoose.model('data', dataSchema);

And this code results in a collection called "users" being created

var User = mongoose.model('user', dataSchema);

Thanks


Mongoose is trying to be smart. You can however force it to be whatever you want:

var dataSchema = new Schema({..}, { collection: 'data' })