You can translate the question and the replies:

Flattening a Mongo Array

I have a Mongo connection that returns data similar to the following: _id : VARCHAR, ticket: \{ status : VARCHAR, recipient : VARCHAR, request_type : VARCHAR \}, stages: \{ supplier: \{ status : VARCHAR, eta : VARCHAR \}, recipient: \{ status : VARCHAR, eta : VARCHAR \}, \} After creating the base view, the ticket and stages return as "Register" when executing the base view. This is in line with the documentation. Is there a way to configure the view to return the data flattened rather than in a "Register"? for example, each value as a seperate column: _id, ticket.status, ticket.recipient, ticket.requesttype, stages.supplier.status, stages.supplier.eta, stages.recipient.status, stages.recipient.eta
user
14-10-2020 14:01:49 -0400

1 Answer

Hi, I would use the Tuple Root property to retrieve only the portion of the required document. You can check out the [JSON Source ](https://community.denodo.com/docs/html/browse/8.0/vdp/administration/creating_data_sources_and_base_views/json_sources/json_sources) Virtual DataPort guide for more details. This would return only a portion of the document so you could create multiple base views each having the required portion of flattened data and these views could be combined in a single derived view. Alternatively, I would use “Project Subfields of” option in the output tab of the view to flatten the register columns. You could refer to[ Creating Flatten Views](https://community.denodo.com/docs/html/browse/latest/vdp/administration/creating_derived_views/creating_flatten_views/creating_flatten_views) of the Virtual DataPort guide for more details. Hope this helps!
Denodo Team
15-10-2020 08:09:58 -0400
You must sign in to add an answer. If you do not have an account, you can register here