Serious BUG Filter Date + Operator $and on Mongodb?


#1

I’m trying to do a query in a MongoDB database with date values but the following situation is occurring:

Filtering with date only goes all normal …
Filter: filter:{"$and":[ {“dt_evento”:{"$date":“2016-11-28T23:21:43.0000”}} ]}

{
“resource”: [
{
"_id": “583cbc0819e33f052c019c06”,
“bem_id”: 22,
“dt_evento”: {
"$date": “2016-11-28T23:21:43+0000”
},
“dt_gps”: {
"$date": “2016-11-28T23:21:43+0000”
},
“latitude”: -24.281786,
“longitude”: -53.840725,
“velocidade”: 0,
“direcao”: 170,
“altitude”: 341

Filtering with Data + ID :


Filter: filter:{"$and":[ {“dt_evento”:{"$date":“2016-11-28T23:21:43.0000”}},{“bem_id”: “58338261bab1178e0a393cec”} ]}

This error only happens when the $ and operator is used. Then I will need to do a Between between 2 dates


#2

See my solution at:
https://github.com/dreamfactorysoftware/df-mongodb/issues/4
The reason is a check in Table.php ofdf- mongodb module limiting the converting to MongoDB Objects to array at length ONE, so if more elements are inside the array the loop is interrupted and dates are not converted.