var InputSchema = new mongoose.Schema({
url: String,
titleSource: String,
urls: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'Url'
}]
});
var UrlSchema = new mongoose.Schema({
description: String,
url: String,
_source: {
type: String,
ref: 'Input'
}
});
but this code return undefined... and only one time (I've several instances of Urls)
Url.find()
.populate('_source', 'titleSource') // only return the Persons name
.exec(function (err, url) {
if (err) return console.log(err);
console.log(url._source);
})