mongoose - Array is not populated -
below code retrieving data.
var userschema = new mongoose.schema({ name: string, uniqueid: string, userid: string, creater_id: string, enquiryid: {type: [mongoose.schema.types.objectid], ref: 'enquirys'}, rptoken: {type: string, default: ''} });
and mongo query
user.find({}).populate('enquiryid').exec(function (err, data) { res.json({'success': true, message: '', data: data}); })
Comments
Post a Comment