Okay so I have an events.js file with an eventSchema:
var eventSchema = mongoose.Schema({
name:{
type: String,
//required: true
venue:{
}
});
and a venue.js with the venue schema:
var mongoose = require('mongoose');
var venueSchema = mongoose.Schema(
{
name:{
type: String,
//required: true
},
postcode:{
type: String,
//required: true
},
town:{
type: String,
//required: true
}
});
My question is how can I have the 'venue' field in the events schema be linked to the venue schema. So essentially when you create a new event you can only add a venue from the list of venues. Thanks in advance!