javascript - Finding property in nested array -
i have following schema:
var searchresults = new mongoose.schema ({ title : string, url : string, description : string, scrapped : {type : boolean, default : false} });
and other 1 :
var searchschema = new mongoose.schema({ original : string, results : [searchresult], // ... });
how should go searching match url value of result?
i read in question like:
var searchmodel = mongoose.model('search', searchschema); searchmodel.findone({'results.url' : "http://www.myurl.com"}, function (err, res) { consle.log(res); });
but doesn't seem work. syntax wrong?
this syntax correct one, error somewhere else.
Comments
Post a Comment