I need to add this filter on every card of the dashboard.
I'm using MongoDB and metabase's latest version
I need to add this filter on every card of the dashboard.
I'm using MongoDB and metabase's latest version
I got it that we can use the field filter for this. Can you suggest me how we can modify the date range query to incorporate this.
[[
{
"$match": {
"$and": [
{
"$expr": {
"$gte": [
"$updatedAt", {{startdate}}
]
}
},
{
"$expr": {
"$lt": [
"$updatedAt", {{enddate}}
]
}
}
]
}
},
]]
We can set the field filter to updatedAt. How do we incorporate this in the query above?
I made this work using this
[[
{
"$match": {{startdate}}
},
]]
Can you help me add another field filter optional clause?
Yes, I need a single date filter and a category filter dropdown. Both should be optional clauses.
@Anum I would strongly recommend that you read the Mongo documentation, so you have a better understanding of how Mongo works and how to create queries.
[[
{
"$match": {
"$and": [
{{field_date}},
{{field_category}}
]
}
},
]]
@flamber, one of the filters is working at a time. Not both and yes i have tried this syntax. This is not working.
See if I write only 1 field filter in the query, it fetches me the result.
This is what worked. Sharing the solution so that others can get benefit.
[[
{
"$match": {
"$and": [
{{name}}
]
}
},
]]
[[
{
"$match": {
"$and": [
{{Daterange}}
]
}
},
]]