Creating a model from a native MongoDB query

Hi there,

I'm relatively new to Metabase, and thus I'm not sure if I have encountered a bug in Metabase or hit some limitation that I simply don't understand yet.

I am trying to create a model from a native MongoDB query. Whenever I try to save that (or any other) query as model, I get told that models with variables are not supported. However, I'm not using variables in that query:

I'm on Metabase 0.45.1. Ist this a problem of Metabase or one of the user?

Thanks in advance for any pointers!

Hi @ableuler
Models are not supported for Mongo, since it requires nested query support.
Create a View directly on Mongo, so Metabase just sees that as a "table".

Upvote by clicking :+1: on the first post of each issue:
https://github.com/metabase/metabase/issues/5645
https://github.com/metabase/metabase/issues/25475

1 Like

Thanks a lot @flamber for the explanation! We have used Mongo views as an alternative, but I was wondering if Metabase models were a way to keep the analytics a bit more separated from our production DB. Of course support for nested queries would be ideal, but if this is not on the short- to mid-term roadmap, at least replacing the error prompt with your explanation above would be very helpful :slight_smile:

@ableuler There's several limitations with Mongo (and some other databases), so in general we should not even offer those options in the UI, which issue 25475 is about (similar to issue 22822).