To be able to query date fields with timestamps, you will need to convert fields value first. It can be done in the aggregation pipeline with $toLong operator:
db.aggregate([
{
// let's assume, you have this example document
// in your solection
$documents: [
{
name: 'Sashko',
birthday: ISODate('2023-07-01'),
}
]
},
// caluclate new field that would contain
// converted timestamp
{
$addFields: {
birthdayTimestamp: {
$toLong: '$birthday'
}
}
},
// then we can match documents by timestamp
{
$match: {
birthdayTimestamp: 1688169600000
}
}
]);
Assuming {CREATED_ON:{$lt:new Date("2023-07-01")}} returns the documents you’re interested in the format for mongodump query, depending on whether it is canonical or relaxed format is: