Using the mongodb input in Benthos, what is the right way to query documents by a date field of type ISODate?
Here's an example of creating such a document using the MongoDB Shell (mongosh):
test> db.createCollection("dates")
{ ok: 1 }
test> db.dates.insertOne({"date": new Date()})
{
acknowledged: true,
insertedId: ObjectId('65c103d3540bd3cffe79bfcb')
}
test> db.dates.find()
[
{
_id: ObjectId('65c103d3540bd3cffe79bfcb'),
date: ISODate('2024-02-05T15:50:43.826Z')
}
]
The date must be passed to the query in RFC3339 format. Here is a working config which leverages the builtin Bloblang timestamp manipulation methods: