graphql-kit / graphql-lodash

🛠 Data manipulation for GraphQL queries with lodash syntax
https://apis.guru/graphql-lodash/
MIT License
1.23k stars 48 forks source link

Is it really possible to flatten the data with some duplication? #34

Open josephIDM opened 4 years ago

josephIDM commented 4 years ago

I have a data structure like below

{ "MyAsset": { "Code": "Cod123", "MyAssetLocation": [{ "Location": { "LocationName": "Location 1" } },{ "Location": { "LocationName": "Location 2" } } ] } } I wanted to write a graphql query against the entity MyAsset in such a way that it should return the data like below.

First record

{code:"Cod123",MyAssetLocation.Location:"Location 1"} Second Record

{code:"Cod123",MyAssetLocation.Location:"Location 2"} Basically I wanted to flatten the result by duplicating MyAsset details with MyAssetLocation.Location Items.