Mongoose populate
I would expect your code to work, too. Does it work if you put the OwnedTag
right in MovieSchema
, like so?
var MovieSchema = new Schema({ title: String, tags: [{ _name: {type: Schema.ObjectId, ref: 'Tag'}, _owner: {type: Schema.ObjectId, ref: 'User'} }]});
edit:
var MovieSchema = new Schema({ title: String, tags: [{ type: Schema.ObjectId, ref: 'OwnedTag' }]});