Referencing Documents // Customer Model const Customer = mongoose.model( ‘Customer’, new mongoose.Schema({ name: String }) ) // Review Model const Review = mongoose.model( ‘Review’, new mongoose.Schema({ rating: { type: Number, required: true }, customer: { // this tells MongoDB to store the ObjectID() for later reference type: mongoose.Schema.Types.ObjectId, ref: ‘Customer’ // references the Customer Model […] Read more
Published: 9th April 2020