MongoDB query

Dear, good afternoon!

In Metabase, using MongoDb, how do I perform a query looking for some columns of 2 documents "tables" and generating a result, to be used in a question?
See an illustration of what I need below.

Hi @Lourival, you need to write a native query to get that, as we don't support joins in MongoDB in Metabase. https://github.com/metabase/metabase/issues/9095

Hi @Luiggi,

But when using "lookup", the aggregated table data is displayed all in a single column "resultado". I don't know how to set just some data from the first table and some data from the second table.

[{
"$lookup" : {
"localField" : "categoria_id",
"from" : "documento2",
"foreignField" : "id_categoria",
"as" : "resultado"
}
}
]

I suggest you go over the MongoDB documentation to see how to make queries with joins in that database engine

Ok, thank you @Luiggi.