Fejlen du får er et resultat af indlejring af Adventure
model i stedet for skemaet. Du skal tilføje Adventure
skema i destinationsskemadefinitionen Adventure
modellens skemaegenskab:
// 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]
});