Her is my mongoose schema code for Users:
var mongoose = require('mongoose');
var userSchema = new mongoose.Schema({
email: {
type: String,
unique: true,
required: true
},
name: {
type: String,
required: true
},
Addtasks : [{
website: String,
otherdetails: String,
exampleRadios: String,
deadline: Date,
Date: String,
fileName: String,
Bigpaths:[]
}]
});
module.exports = mongoose.model('User', userSchema);
And this is mongodb data stored in jSON format:
{
"_id" : ObjectId("5f378bec5bd30f3248ffae59"),
"email" : "[email protected]",
"name" : "Vikas Yadav",
"Addtasks" : [
{
"website" : "grumpytext.com",
"keywords" : "article importance, article generation, article quality",
"words" : 1234567,
"topic" : "How article is generated?",
"_id" : ObjectId("5f379c7164a77a338483704c"),
"Bigpaths" : [
{
"path" : "public\\files\\chrome.VisualElementsManifest.xml",
"name" : "chrome.VisualElementsManifest.xml"
},
{
"path" : "public\\files\\chrome_proxy.exe",
"name" : "chrome_proxy.exe"
},
{
"path" : "public\\files\\master_preferences",
"name" : "master_preferences"
}
]
}
],
}
Now what I want is that to iterate the Bigpaths nested array only which is inside Addtasks array and get the data from it for every object of its through loop. How can I achieve that? I have tried kind of populate() thing but seems doesnt help. Please help!!
Desired Result:
[
{
"path" : "public\\files\\chrome.VisualElementsManifest.xml",
},
{
"path" : "public\\files\\chrome_proxy.exe",
},
{
"path" : "public\\files\\master_preferences",
}
]
Expected Result on UI side (handlebar):
Path 1 = public\\files\\chrome.VisualElementsManifest.xml
Path 2 = public\\files\\chrome_proxy.exe
Path 3 = public\\files\\master_preferences