Given this DB collection structure:
{
"_id" : ObjectId("59ba5bf6fa12aa446c097793"),
"tab" : "tab1",
"tabfeeds" : [
{
"url" : "//url1",
"limit" : 4,
"type" : "text"
},
{
"url" : "//url2",
"limit" : 8,
"type" : "normal"
}
]
}
{
"_id" : ObjectId("59ba73a6fa12aa446c097794"),
"tab" : "tab2",
"tabfeeds" : [
{
"url" : "//url5",
"limit" : 4,
"type" : "normal"
}
]
}
I can get all the "tabs" collection like this:
router.get('/tabs', function(req, res) {
var db = req.db;
var collection = db.get('tabs');
collection.find({},{},function(e,docs){
res.json(docs);
});
});
And then:
$.getJSON( '/feeds/tabs', function( data ) {
$.each(data, function(){
tablistcontent += '<th rel="' + this.tab + '">' + this.tab + '</th>';
});
});
But how can I list every element of tabfeeds for each tab?