Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Onyi_Nwabia-Robbins
Contributor III
Contributor III

Loading a child array from Mongo DB collection

Hi everyone, 

Having issues with loading a child array from within a parent array . I am aware of this solution, but I really don't understand it to be honest. 

Connection to Mongo DB: Using ODBC connection via System DSN to connect to Mongo DB shard

By default when loading table, Qlik only catches parent elements as shown below:

Script
LOAD
id,
fa.count,
fa.spares,
fa.status;
SQL SELECT
id,
fa.count,
fa.spares,
fa.status FROM store.reservations;

Child array
fa.siteCodes - this is a list of codes that exists as part of fa array. For every id, the value of fa.count and fa.spares will equal the number of elements in fa.siteCodes. 
I know I need to do a sub query and it needs to link to the specific id,  but I am not sure how to achieve this. 

Attempt to get child array
LOAD
id,
fa.count,
fa.spares,
fa.status,
fa.siteCodes;
SQL SELECT
id,
fa.count,
fa.spares,
fa.status,
(SELECT * FROM store.reservations.fa.siteCodes) as fa.siteCodes
FROM store.reservations;

Is my attempt correct at all?

 

Labels (6)
1 Solution

Accepted Solutions
Onyi_Nwabia-Robbins
Contributor III
Contributor III
Author

I seem to have solved my own issue. 

No requirement for subqueries, Qlik actually uploads this as a seperate table. 

Click to select data from your MongoDB connection

Select the relevant collection

Keep scrolling down the child elements are brought up as separate tables. 

Select and insert.

In my case this table was store.reservations_fa_siteCodes, which comes up as reservations_fa_siteCodes in the list.

View solution in original post

1 Reply
Onyi_Nwabia-Robbins
Contributor III
Contributor III
Author

I seem to have solved my own issue. 

No requirement for subqueries, Qlik actually uploads this as a seperate table. 

Click to select data from your MongoDB connection

Select the relevant collection

Keep scrolling down the child elements are brought up as separate tables. 

Select and insert.

In my case this table was store.reservations_fa_siteCodes, which comes up as reservations_fa_siteCodes in the list.