How to declare collection name and model name in mongoose

后端 未结 4 1540
死守一世寂寞
死守一世寂寞 2021-02-02 18:26

I have 3 kind of records,

1)Categories,
2)Topics  and
3)Articles 

In my mongodb, i have only 1 colection named \'categories\' in which i stroe

4条回答
  •  青春惊慌失措
    2021-02-02 18:54

    "The first argument is the singular name of the collection your model is for. Mongoose automatically looks for the plural version of your model name" - directly from the Model docs -- https://mongoosejs.com/docs/models.html

提交回复
热议问题