How to get Schema of mongoose database which defined in another model

后端 未结 5 1174
南笙
南笙 2020-12-07 12:32

This is my folder structure:

+-- express_example
|---- app.js
|---- models
|-------- songs.js
|-------- albums.js
|---- and another files of expressjs
         


        
5条回答
  •  有刺的猬
    2020-12-07 13:21

    var SongSchema = require('mongoose').model('Song').schema;
    

    The above line of code in your albums.js will surely work.

提交回复
热议问题