Kesalahan yang Anda dapatkan adalah akibat menyematkan Adventure
model bukan skema. Anda perlu menambahkan Adventure
skema dalam definisi skema tujuan Adventure
properti skema model:
// this is the "destination" model for mongoose
var mongoose = require('mongoose');
var AdventureSchema = require('../models/adventure').schema; /* <- access the schema via its Model.schema property */
var tripSchema = mongoose.Schema({
name: { type: String, required: true },
city: { type: String, required: true },
dateStart: { type: Date, required: true },
dateFinish: { type: Date, required: true },
adventures: [AdventureSchema]
});