Hi there!
I have been using Metabase for some years already with Postgres, and now I have a product in which we have the information in MongoDB.
I have verified that using an ObjectId
is well represented, but it is not the case for UUIDs. Here is an example of how they look like:
Mongo offers a specific BSON Type for UUID as binary data, you can see them here .
In specific, they store the UUID as a subtype 4 .
If I inspect the data, it looks like this:
{
"_id": {
"$binary": {
"base64": "ZD+zq5sNTRSnfvfz1/n1HA==",
"subType": "04"
}
}
}
It looks like Metabase isn't parsing the Mongo binary BSON types properly.
Has anyone been able to parse correctly UUID for IDs in Mongo? It is preventing us to use Metabase build dashboards as filtering by ID using a UUID format isn't possible.
Happy to help to implement a PR if this isn't implemented with some pointers to how to do it
leeloo
July 10, 2024, 6:58pm
2
I don't know that I fully understand what you mean when you says it's not parsing correctly. Can you elaborate on what exactly you're trying to do in the product? Do either of the below feel related to your situation?
We do have some issues with remapping and UUIDs:
opened 07:27PM - 29 Apr 24 UTC
Type:Bug
Priority:P2
Querying/Remapping
.Team/QueryProcessor
### Describe the bug
Set up a table in Metabase that has a foreign key relati… onship targeting another table. The "display value" is configured to show a value from the other table. If you set up a filter that shows the list of values the chose "display value" works if the entityID is an INT type. If it's a test/varchar then it works briefly when you first set it up) but the name quits displaying pretty quickly.
### To Reproduce
1. Create TableA with a variable character entity ID and a "aName" column
2. Create TableB with a few of the varchar IDs from TableA
3. On TableB set the entityID as a foreign key and target TableA. Set "Filtering on this field" to "List" (if necessary) and set the display value to "aName"
4. Create a Question that lists records from TableA, add to a dashboard
5. Create a dashboard that filters on entityID from tableA
6. Note that the pretty name displays in the filter as expected, but only briefly
7. After a couple of minutes and a refresh it falls back to duplicating the IDs only
This behavior happens with text filters or ID filters set up from the dashboard. This behavior also occurs on field filters on the questions.
### Expected behavior
If a foreign key relationship is defined and a "display value" is set we should see that display value in the the dropdown menus.
### Logs
_No response_
### Information about your Metabase installation
```JSON
{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.22+7",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.22",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.22+7",
"os.name": "Linux",
"os.version": "5.15.133.1-microsoft-standard-WSL2",
"user.language": "en",
"user.timezone": "GMT"
},
"metabase-info": {
"databases": [
"postgres",
"h2",
"bigquery-cloud-sdk",
"mysql",
"snowflake"
],
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "11.22 (Debian 11.22-1.pgdg110+1)"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.7.2"
}
},
"run-mode": "prod",
"version": {
"date": "2024-04-11",
"tag": "v1.49.5",
"hash": "31c4887"
},
"settings": {
"report-timezone": "Asia/Tokyo"
}
}
}
```
### Severity
Not exactly a blocker but it has a significant impact on usability in cases where we'd expect this to work.
### Additional context
The filters technically work but their usability is arguable - no one knows what these long strings actually refer to in the underlying datasets.
Loom recording: https://www.loom.com/share/e12d05a433c34cc4a63e11d2568eb684
And filtering on UUIDs:
opened 09:18AM - 10 Jan 24 UTC
Type:Bug
Priority:P1
Querying/MBQL
.Backend
Querying/Models
.Team/QueryProcessor
### Describe the bug
I was trying to filter for a specific ID in a model in the… filter widget and then the page crashed.
This seems to be related to a GET `/api/field/:id/search/:id` endpoint returns HTTP 204 no content instead of an empty array.
There is a workaround to just filter on the normal column dropdown in the model table view.
### To Reproduce
I couldn't reproduce it for other models than the one where it broke but here is what I did (more context in the video in our [Slack](https://metaboat.slack.com/archives/C01LQQ2UW03/p1704872831507539))
1. Go to a model page
2. Click on the "Filter" button on the top
<img width="220" alt="image" src="https://github.com/metabase/metabase/assets/29712801/33308fd0-17a4-476e-9c13-4514d42878cd">
3. Scroll down to the entity id field and start typing
<img width="813" alt="image" src="https://github.com/metabase/metabase/assets/29712801/5a6acda6-79c9-47ca-8466-b50964edede4">
4. See error
<img width="656" alt="image" src="https://github.com/metabase/metabase/assets/29712801/2965f023-f86c-49b8-a77f-393ba93600e8">
### Expected behavior
_No response_
### Logs
Some logs from the console:
```
TypeError: e.map is not a function or its return value is not iterable
at Q (utils.ts:33:22)
at SearchValuePicker.tsx:40:11
at Object.ig [as useMemo] (react-dom.production.min.js:162:119)
at t.useMemo (react.production.min.js:25:113)
at J (SearchValuePicker.tsx:39:19)
at o6 (react-dom.production.min.js:153:146)
at iF (react-dom.production.min.js:175:309)
at l (react-dom.production.min.js:263:406)
at aH (react-dom.production.min.js:246:265)
at react-dom.production.min.js:246:194
```
### Information about your Metabase installation
```JSON
{
"browser-info": {
"language": "en-GB",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.21+9",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.21",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.21+9",
"os.name": "Linux",
"os.version": "5.10.201-191.748.amzn2.x86_64",
"user.language": "en",
"user.timezone": "GMT"
},
"metabase-info": {
"databases": [
"druid",
"mysql",
"postgres",
"redshift",
"bigquery-cloud-sdk",
"mongo",
"h2",
"snowflake"
],
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "14.7"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.7.1"
}
},
"run-mode": "prod",
"version": {
"date": "2024-01-09",
"tag": "vUNKNOWN",
"hash": "30fff3b"
},
"settings": {
"report-timezone": "US/Pacific"
}
}
}
```
### Severity
annoying
### Additional context
_No response_
We love it when folks are interested in contributing to the product! For more information on that check out this page in the developers guide:
Contributing to Metabase Thank you First off, thanks for your interest in Metabase and for wanting to contribute! In this guide, we’ll discuss how Metabase is built. This should give you a good sense of our process and where you...
Sure, what I meant is that the ID is represented as org.bson.types.Binary@<something>
instead of 5ebf0f3c-042e-4cff-acc5-9483532c6afe
.
A UUID type using Postgres is displayed correctly as:
Here is an example of Mongo using an UUID (first row) and an ObjectId (second row)
It looks like the mongo driver is missing the parsing or formatting for the UUID type.
leeloo
August 23, 2024, 3:37pm
4
I apologize for missing your last reply on this thread. I see you went ahead and created a Github issue for this: Mongo UUID not displayed correctly and filter not working · Issue #45626 · metabase/metabase · GitHub
Thank you for doing that! I wanted to make sure it was also linked here in case anyone else stumbled across this post.