When I use the parameter $human Time inside an array, Redash shows me the following error:

This is a file example:

{“rep” : [
{
“version” : 3,
“ruta” : “formurl”,
“fechaDiligenciamiento” : ISODate(“2019-12-02T16:12:12.895Z”)
},

The query that I´m using is:

{
“collection”: “test”,
“aggregate”: [
{
“$match”: {
“$and”: [
{
“grafic”: {
“$elemMatch”: {
“version”: {
“$in”: [
3
]
}
}
}
}
]
}
},
{
“$project”: {
“rep”: {
“$filter”: {
“input”: “$grafic”,
“as”: “grafic”,
“cond”: {
“$and”: [
{
“$gte”: [
“$$grafic.version”,
3
]
},
{
“$$grafic.fechaDiligenciamiento”: {
“$gte”: {
“$humanTime”: “{{Fecha Inicio}} 00:00:00”
},
“$lte”: {
“$humanTime”: “{{Fecha Fin}} 23:59:59”
}
}
}
]
}
}
}
}
},
{
“$project”: {
“usuario”: 1,
“count”: {
“$size”: “$rep”
}
}
},
{
“$group”: {
“_id”: “”,
“total”: {
“$sum”: “$count”
}
}
},
{
“$project”: {
“_id”: 0,
“total”: “$total”
}
}
],
“options”: {
“cursor”: {
“batchSize”: 50
},
“allowDiskUse”: true
}
}

I don’t think this is an issue with $humanTime. The error message indicates you have a typo somewhere. My guess is that $$grafic.fechaDiligenciamiento should be $grafic.fechaDiligenciamiento (one dollar sign, not two).

when the date field is in a field that is not an array field. the humantime date parameter works correctly,

this error occurs when you have a date inside an array.
tried these 4 different ways

representacionGrafica.$fechaDiligenciamiento
$$representacionGrafica.$fechaDiligenciamiento
$$representacionGrafica.fechaDiligenciamiento
representacionGrafica.fechaDiligenciamiento

{
“$match”: {
“$and”: [
{
“fechaEnvio”: {
“$gte”: {
“$humanTime”: “{{Fecha Inicio}} 00:00:00”
},
“$lte”: {
“$humanTime”: “{{Fecha Fin}} 23:59:59”
}
}
},
{
“idEmpresa”: {
“$eq”: “860009578”
}
}
]
}
}