Reputation: 1
I have a document in document db that has a property that is an array of an object. I would like to flatten it and get a single property in all the objects in terms of an array.
eg:
{
"name" : "blah",
"address" : [
{
"type" : "home",
"location" : "123 st"
},
{
"type" : "work",
"location" : "321 st"
}
]
}
-> What I want
[
{
"name" : "blah",
"locations" : [ "123 st", "321 st" ]
}
]
Upvotes: 0
Views: 671
Reputation: 27793
You could try to define and use User-defined function to extract locations
info.
And then you could call this User-defined function from inside your query.
Upvotes: 1