Can I embed a Schema within a Schema in Mongoose?
SocialProfileSchema = new mongoose.Schema
source: String
user_id: String
profile_url: String
UserProfileSchema = new mongoose.Schema
socia开发者_JAVA百科lProfiles: [SocialProfileSchema]
That's my code. Is it valid?
Yes! This is valid it turns out!
That code will create an embedded documents array of SocialProfiles within UserProfiles -- http://mongoosejs.com/docs/embedded-documents.html
精彩评论