The scenario is as follows:
One product can be in Many orders, and one order can have many products. How to structure many-to-many relationships using mongoose and node.js ?
I have given the product model below. However, I am not sure how the order model should be. Can someone please help me figure this out. I am new to Node/ Mongoose and hope someone will help me out with this.
CODE
var mongoose = require('mongoose');
var productSchema = mongoose.Schema({
product:{
type: String,
unique: true,
required: true
},
price:{
type: String,
required: true
},
create_date:{
type: Date,
deault: Date.now
}
});