Hi everyone,
I have a problem with a date field. I’m trying to make query him for example trying to find dates older than x date, but I always get an error or nothing is returned. Maybe is the way the field is formatted but I couldn’t find why. If somebody please can help me understand where’s the error.
The date field schema is the following:
"created": {
"$date": {
"$numberLong": "1640630359000"
}
}
I have like a thousand documents with this field. In mongosh I query a find:
db.clients.find({created: {$lt: new Date('2022-01-08')} })
but the query didn’t returned anything. I also tried to convert to string and had an error and also tried to make a match aggregation and returned nothing. In the aggregation app of compass I can see the field with this kind of value field display:
created: 2021-12-27T18:39:19.000+00:00
and in the document schema in compass it shows is a date field.
Thanks for the help.