I have two schemas - Match and Member. Match contains an array of Members.
var MatchSchema = new Schema({name: String, players: [{ player: { type: Schema.ObjectId, ref: 'Member'}, play: Boolean}]}); var MemberSchema = new Schema({ firstName: String, lastName: String}); I'm trying to populate the the ObjectIds with per http://mongoosejs.com/docs/populate.html
.populate({ path: 'players', populate: {path: 'player'} }) Per Mongoose debug, the matches.find query returns the two expected Member ObjectIds, ...
Mongoose: matches.findOne({ _id: ObjectId("5883a57362f0ca10945b305a") }, { fields: undefined }) Mongoose: matches.find({ _id: { '$in': [ ObjectId("58502d28e88746467d48b424"), ObjectId("583c82ef5274831a5443fa53")] } }, { fields: undefined }) but match.players.player is not populated with firstName or lastName.
I believe that I've tried all of the combinations/options of population syntax. Any ideas?
mongoose.set('debug', true);May sure you are looking at the server console/terminal and not the client.