pete_my
November 18, 2019, 2:31am
1
Hey,
Is there any way to create a Segment with a Native query? I need to segment on data within an array from MongoDB.
data[].SegmentData === “somedata”
{
“data”: [
{
“SegmentData”: “somedata”
},
{
“SegmentData”: “someotherdata”
}
]
}
Any pointers or help greatly appreciated,
Thanks in advance
flamber
November 18, 2019, 3:06am
2
Hi @pete_my
I’m not sure what you’re asking, since I don’t know MongoDB, but is this specific to Metabase or a general MongoDB question?
Currently it’s not possible to use Native/SQL queries as segment/metric:
https://github.com/metabase/metabase/issues/5194 - upvote by clicking on the first post
For general MongoDB question, then you’ll probably find better help in one of their communities:
https://www.mongodb.com/community-support-resources
pete_my
November 18, 2019, 3:10am
3
Thanks @flamber . Apologies for the confusion, this was a Metabase question, not MongoDB.
I’ve upvoted the Issue, this is the feature I’m looking for.
Are there any workarounds for this? I tried quickly hacking the Segment table in the DB to include a native query, but it didn’t work.
flamber
November 18, 2019, 3:16am
4
@pete_my
I would highly recommend not messing around in the metadata manually - make sure you have backups, since you can easily corrupt it.
I’m not sure what you’re trying to do, but with other databases you can get around a lot of things with Views
or Procedures
- I don’t know Mongo.
You might also be interested in this issue:
https://github.com/metabase/metabase/issues/10327 - upvote by clicking on the first post
pete_my
November 18, 2019, 3:23am
5
Thanks, yes, everything is backed up and safe. It was worth the quick experiment.
I’ll keep an eye on the mentioned issues and continue with my other workaround.
Cheers.