New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to add filter for question created on MongoDB custom aggregation query #7442

Open
madhurtewani opened this Issue Apr 25, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@madhurtewani
Copy link

madhurtewani commented Apr 25, 2018

Hi,

We are using Metabase v0.28.1 (fe0c411 release-0.28.1) hosted on Docker version 17.05.0-ce, build 89658be with MongoDB 3.2.19 on Ubuntu 16.04.

We have used the native methods provided by the Metabase to make questions and dashboards.
We have also used filters to fetch the data as per the need.

However for a few questions we have implemented custom aggregation queries on the MongoDB, where it required joining collections or looking up referred collections. We are able to get the results through these queries.

Coming to the issue, when we are trying to add filters to these custom-query questions, we are unable to do so.

The exact query is mentioned below.

[
{
    "$unwind":"$appUser"
},
{
    "$lookup":{
        "from":"appuser", 
        "localField":"appUser",
        "foreignField":"_id", 
        "as":"appUser"
    }
},
{
    "$lookup":{
        "from":"product", 
        "localField":"product",
        "foreignField":"_id", 
        "as":"product"
    }
},
{
    "$lookup":{
        "from":"subscription", 
        "localField":"subscription",
        "foreignField":"_id", 
        "as":"subscription"
    }
},
{
    "$lookup":{
        "from":"promocode", 
        "localField":"promoCode",
        "foreignField":"_id", 
        "as":"promoCode"
    }
},
{
    "$project":{
        "id":1,
        "createdAt":1,
        "customer ID":"$appUser._id",
        "customer name":"$appUser.fullName",
        "contact number": "$appUser.phoneNumber",
        "product": "$product.name",
        "price":1,
        "discount":"$promoCode.discountValue",
        "promocode":"$promoCode.promoCode",
        "totalPrice":1,
        "pgPaymentStatus":1,
        "status":1,
        "txnType":1,
        "subscription":"$subscription._id",
        "pgOrderId":1,
        "pgPaymentId":1
    }
}
]

Couple of screenshots of the issue:
metabase_1
Above screenshot shows unable to select Created At for Date filter.

metabase_2
Above screenshot shows that the field Created At is set as category.

Please advise on how to go about this.

@salsakran

This comment has been minimized.

Copy link
Contributor

salsakran commented May 2, 2018

we don't support native query templates with mongo at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment