Viewing: Mongoose

Mongoose – Modeling Relationships Between Connected Data

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