I am completely new to mongodb and I was trying to get an object from nested array, in the above mentioned array of objects I want to access an object where Fname should be Svelte and chapterName should be Chapter 0.
[
{
_id: { oid: '6393fc35a2bd7da5c33e31a9' },
Fname: 'Svelte',
__v: { numberInt: '0' },
data: [
{
chapterName: 'Chapter 0',
notes: [
[
'<h2 id="heading1">About Svelte</h2>',
'<br>',
'<p id="p1">Its an compiler which compiles all the code and then bundel it using any one of the bundling tools.</p>',
'<br>',
'<p id="p2">It is very easy to understand as it somewhat looks like vanilla javascript.</p>'
]
],
_id: { '$oid': '6393fc35a7f6aef6477ab3eb' }
},
{
chapterName: 'Chapter 1',
notes: [
[
'<h2 id="heading1">onMount</h2>',
'<br>',
'<p id="p1">something about onMount funciton in svelte.</p>'
]
],
_id: { '$oid': '639425eb9037e86ffc337505' }
}
]
},
{
_id: { oid: '6395718e137c1a3763a0fefd' },
Fname: 'Cpp',
__v: { '$numberInt': '0' },
data: [
{
chapterName: 'Chapter 0',
notes: [
[
'<br>',
'<p id="p1">Enter your paragraph here.</p>',
'<h2 id="heading2">Enter your heading here</h2>'
]
],
_id: { '$oid': '6395718e15ec262729cc45be' }
}
]
}
]
In short, I need this object
{
chapterName: 'Chapter 0',
notes: [
[
'<h2 id="heading1">About Svelte</h2>',
'<br>',
'<p id="p1">Its an compiler which compiles all the code and then bundel it using any one of the bundling tools.</p>',
'<br>',
'<p id="p2">It is very easy to understand as it somewhat looks like vanilla javascript.</p>'
]
],
_id: { '$oid': '6393fc35a7f6aef6477ab3eb' }
}
What will be the query to extract this object ? Thank you so much for you help.