You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My document has a document that has a document. I wanted to find out how i can populate the inner document as well. I have tried this but it is not populating my innter document.
Document.find({})
.populate('owner')
.populate('owner.company')
.run(function(err,docs){
if(err){
req.flash('error', 'An error has occured. Please contact administrators.')
}
console.log(docs);
res.render('dashboard/index', { title: 'Dashboard', menu: 'Dashboard', docs: docs});
var mongoose = require("mongoose"),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId,
DocumentObjectId = mongoose.Types.ObjectId;
var Document = new Schema({
filepath: {type: String, required: true},
createdBy: {type: String, required: true},
created: {type: Date, default: Date.now},
owner: {type: ObjectId, ref: 'owner'}
});
var Owner = new Schema({
fullname: {type: String, required: true},
company: {type: ObjectId, ref: 'company'}
});
var Company = new Schema({
name: {type: String, required: true},
});
The text was updated successfully, but these errors were encountered:
My document has a document that has a document. I wanted to find out how i can populate the inner document as well. I have tried this but it is not populating my innter document.
The text was updated successfully, but these errors were encountered: