The documents I’m trying to select a number of fields from contain an array of very large objects, and I only need a couple fields from each of those objects in the array.
Is there a way to select just the fields I need in that array and keep the nested structure?
document example:
{
“a” : “AA”,
“b” : “BB”,
“c” : [ { “aa” : “aa1”, “bb” : “bb1”, “cc” : “cc1”, “dd” : “dd1”, “ee” : “ee1” },
{ “aa” : “aa2”, “bb” : “bb2”, “cc” : “cc2”, “dd” : “dd2”, “ee” : “ee2” }]
“d” : “DD”
}
query result should look something like this:
{
“a” : “AA”,
“b” : “BB”,
“c” : [ { “aa” : “aa1”, “bb” : “bb1”},
{ “aa” : “aa2”, “bb” : “bb2” }]
}
I figured out how to UNNEST c and select the values I need, but then I can’t figure out how to NEST it again or somehow make it into an array of objects