How to identify these IDs. I have the queries already set up

Hi everyone,
I am trying to identify these artist_ids.

I don;t know how to set this up because I already have a the queries set up here:

Does anyone know how to relate these two data points? They show up in the KeyValue2 on the left but it is not showing in the table. Any help would be greatly appreciated, thank you

Hi @WXLLSPACE!

Just so that I'm sure what you're looking for - you'd like to have the fields returned by your MongoDB query also be columns in your table?

Hey @Kabirdas
Thank you for reaching out. So I want to identify the “_ids” so it shows the customer names. How do I associate the name with the record ID?

Hey @WXLLSPACE,

As I understand your problem you are trying to show the 'name' of each artist as a field in your table and the name of each artist is in a separate document in MongoDB that can be referenced with the artist_id shown in your table. If that is the case then here is my suggestion.

Write an additional query to your MongoDB resource that pulls all of the artist documents. Then write a Query JSON with SQL query to join the 'name' field from the artist documents (a.name) with all of the fields from the documents shown in the table (b.*) into one dataset.

Here's an example of a Query JSON with SQL query where I join a Mongo query with a Postgres query (on matching 'blarg' and 'name' columns, respectively)

Mongo queries return their .data as an array of objects (perfect for the Query JSON with SQL query type), so we are good to use {{ mongoQuery.data }} in the example below. Others (like Postgres) return an object of arrays, so we use the formatDataAsArray method to transform postgresQuery.data into an array of objects in the example below.

Your query would join the data from the query for all artists with the data from the query that currently populates the table on a._id = b.artist_id (as an example). You could then display this data in your table.

Here is an example of what your 'Query JSON with SQL' could look like

select a._id, b.* from {{ artistQuery.data }} a join {{ tableQuery.data }} b on a._id = b.artist_id

I hope that I am understanding your problem correctly and that this suggestion helps :smiley:

Thank you for this. I am not using PostGres, only MongoDB. I believe the person who set this up has already done it. Could you provide some paid assistance? It shouldnt be very long, mayb 30 mins at most.

Hey @WXLLSPACE, I was only providing this as an example. I wanted to show how you could use 'Query JSON with SQL' to query data from both resources that return data as an array of objects (such as MongoDB) and resources that return data as an object of arrays (such as Postgres).

I am not able to provide any paid assistance, but we do have a Developer Network! I would recommend you put in a request on our Developer Network for the assistance you need :slightly_smiling_face: