Created
March 27, 2015 18:54
-
-
Save danared/a8e26ad6948da1261757 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var personSchema = new mongoose.Schema({ | |
name: String | |
}); | |
var bandSchema = new mongoose.Schema({ | |
name: String, | |
lead: { type: mongoose.Schema.Types.ObjectId, ref: 'person' } | |
}); | |
var Person = mongoose.model('person', personSchema, 'people'); | |
var Band = mongoose.model('band', bandSchema, 'bands'); | |
var axl = new Person({ name: 'Axl Rose' }); | |
var gnr = new Band({ name: "Guns N' Roses", lead: axl._id }); | |
// Save Person and Band |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment