Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RGouda
Frequent Visitor

Unable to select array items from a Mongodb collection through ODBC BI connector in Power Query.

Hi, everyone. I am facing issues in PowerQuery while selecting/querying array items from the https://studio3t.com/knowledge-base/articles/sql-query/#querying-arrays link. 
I have a collection below, want to select the array elements in my power query. Please let me know if I missed anything. 

RGouda_0-1654780989146.png

RGouda_1-1654781009076.png

 

Below are the errors I am getting:

RGouda_2-1654781038389.png

 

RGouda_3-1654781048013.png

Please help!

 

6 REPLIES 6
RGouda
Frequent Visitor

@rohit_singh, your approach to load all columns and expand nested columns is taking a lot of time to load. That's the reason, I have chosen to select/query the required columns I use in the report. I want to restrict unnecessary columns in my dataset.

I am not only facing this issue for this collection but there are multiple collections as such. Considering my huge data size, I opted for this method of selecting/querying the required columns. 

RGouda
Frequent Visitor

Thanks @rohit_singh for your quick response. I am using MongoDB ODBC driver as listed below. 

RGouda_0-1654870595503.png

 

Thanks for confirming @RGouda . In that case I would suggest a workaround by loading the table without writing an SQL statement, which means loading all columns into Power Query. You can then expand the nested columns you need manually and use them, and remove any other columns you don't need.

Kind regards,

Rohit

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

RGouda
Frequent Visitor

Thanks for your input @rohit_singh, I have tried as you suggested but it did not work.

RGouda_0-1654868179959.png

 

RGouda_1-1654868179965.png

I have tried different syntaxes for the highlighted queried column, but the result is same popping up with errors as mentioned in my post.

  1. `worlimatka_result_playerCards.0.card.rank`
  2. [worlimatka_result_playerCards.0.card.rank]
  3. `worlimatka_result_playerCards[0.card.rank]
  4. `worlimatka_result_playerCards[0].card.rank`
  5. `worlimatka_result_playerCards.[0].[card].[rank]`

RGouda_2-1654868179968.png

Hi @RGouda ,

Sorry to hear that didn't work out for you. I'mvnot really sure why this might be happening. I was reading through the official Mongodb documentation for the BI connector and maybe this could help 
https://www.mongodb.com/docs/bi-connector/current/components/

rohit_singh_0-1654868633525.png

You seem to be using the MySQL driver which is not listed for use with PowerBI. Maybe it is worthwhile trying a different driver for ODBC connection with PowerBI?

Kind regards,

Rohit


rohit_singh
Solution Sage
Solution Sage

Hi @RGouda ,

If you are using BI connector to connect to mongodb, you will first need to check the schema of the table you're trying to query, since column names might be different from the mongo document.

When you connect to odbc, please select only your odbc connection name and enter the connection string. Leave the SQL statement section blank and click on ok.

rohit_singh_1-1654865663456.png

In the navigator window, you will see a list of tables. Navigate to the table you want to query (worlimatka_result) and check the column names. You can then modify your initial query according to the actual column names to query the data.

rohit_singh_2-1654865821686.png

 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors