我有两个模块:book
和club
。我在book模块中使用了猫鼬模式,其中包含一些信息。我想导出它,并将其用作俱乐部架构中的文件。
可以访问book
模块中的club
模块中读取的书籍。
bookModule
var mongoose = require('mongoose');
//Book Schema //Just for the application
var bookSchema = mongoose.Schema({
title:{
type: String,
required: true
},
genre:{
type: String,
required: true
},
description:{
type: String,
},
create_date:{
type: Date,
default: Date.now
}
});
var Book = module.exports = mongoose.model('Book', bookSchema)
clubModule:
var mongoose = require('mongoose');
var clubSchema = mongoose.Schema({
name:{
type: String,
required: true
},
booksRead:{
//Here, I am trying to use the information used in the bookSchema Module.
},
});