I have some documents in my mongodb database with the following structure, I want to know how to create an index for document.data.0.data[0-9999].val1?
My problem is where I type [0-9999] I don't know how many elements will be inside this data array, but I want that all the elements inside this array have an index on the val1 key.
Any tips?
{
"_id" : ObjectId("55c455c2fc07853b78c4b6b9"),
"data": {
"0": {
"data": [
{
val1: "abc",
val2: "def"
},
{
val1: "abc",
val2: "def"
}
]
}
}
}