I’m looking for a solution to convert a UUID to a string using projection. I’ve tried many different ways, but none of them are working.
The stranger thing is that Metabase displays the ID correctly, but I cannot manipulate this data because it’s not in string format.
Thanks a lot
Benjamin
2
Answers
@rickhg12hs
Thank you a lot, your answer help me !
But in my case my Id was BinData 3
I refactor your answer as follow :
and is work perfectly
RESULT
https://mongoplayground.net/p/qf7e5d2aA41
I hope there is a better answer as I consider this very fragile since it depends on JavaScript execution being enabled on the MongoDB server and a fixed
toString
representation ofBinData
UUID. Until there is something better, perhaps this is good enough.Example document:
Example output:
Try it on mongoplayground.net.