What are Mongoose (Nodejs) pluralization rules?

前端 未结 3 1463
北恋
北恋 2020-12-18 20:12

I am a newbie to the Node.js, Mongoose and Expressjs. I have tried to create a table \"feedbackdata\" using the Mongoose in MongoDB via the following code. But it is created

3条回答
  •  轮回少年
    2020-12-18 20:34

    Provide the name for the collection in options while creating schema object, then Mongoose will not do pluralize your schema name.

    e.g.

    var schemaObj = new mongoose.Schema(
    {
     fields:Schema.Type
    }, { collection: 'collection_name'});
    

    For more Info: http://mongoosejs.com/docs/guide.html#collection

提交回复
热议问题