Metabase | mongodb | date field filter variable | Error: Field 1,521 is not present in the Query Processor Store

Hi,

I've just upgraded to 0.34.0. I have been trying to implement the field filters for a mongodb date field, but I get this error "Error: Field 1,521 is not present in the Query Processor Store.". Uncertain if I'm doing something wrong. I've looked at metabase documentation for this at - Redirecting…

.

Edit:
Have also tried this as is documented for using a "field filter" but with same results as earlier (document reference: When using a field filter, the column name should not be included in the SQL. Instead, the variable should be mapped to a field in the side panel)

[
{
"$project": {
"_id": false
}
}[[ ,{
"$match": {
{{ datefield }}
}
}]]
]

Hi @sowmyamani

Try giving this syntax a try with the field filter:

[ {$match: {{date_var}} } ]

Or this with a Date filter:

[{"$match":{"datefield":{"$lte": {{ something }} }}}]

If those don’t work either, there may be a deeper issue.

Thank you for your reply. I’ve tried this but haven’t been able to get it to work.

Interestingly, it works for other collections in my DB. I have this problem with this particular collection (and one another). Each document in these collections are 100-200 KB in size and have several 100 fields - that’s the difference between these collections and others where the date filter works. I have also set the altered the “field settings” in the data model for the collections and set them to “creation timestamp” but with the same issue

Interesting...that error message indicates that there is some issue loading the field from the database. It looks like you're running into this same issue: MongoDB Field filters variable in native query with nested fields not working · Issue #11597 · metabase/metabase · GitHub

Feel free to go ahead and upvote that issue by adding a :+1: on the first comment if it's the same thing.

Seems like the same issue. Awaiting the official fix release now. Thanks again!

I am having an issue with this syntax for field filter. “JSON reader was expecting a name but found ‘{’.”

[
{
    $lookup: {
      from: "generaltypes",
      localField: "healthStatus",
      foreignField: "_id",
      as: "health",
    }
},
{
    $lookup: {
      from: "roles",
      localField: "role",
      foreignField: "_id",
      as: "role",
    }
},
 {
    $lookup: {
      from: "schools",
      localField: "school",
      foreignField: "_id",
      as: "company",
    }
},
 {
    $lookup: {
      from: "subjects",
      localField: "subjects",
      foreignField: "_id",
      as: "department",
    }
},
{$match: {
        "role.handle": {$in: [
                "NON-CRITICAL",
                "CRITICAL"
            ]
        },
        {{Company}}
    }
},
{$unwind: "$health"},
{
 $group: {
   _id: "$health._id",
    status: { $min: "$health.value"
        },
   total: { $sum: 1
        }
    }
}
]);

However when I use text field I am able to match records

For reference: Field Filter for Query does not return result, but Text Field works