chang the format while checking the date range mongo code example

Example 1: between in mongodb

items.save({
    name: "example",
    created_at: ISODate("2010-04-30T00:00:00.000Z")
})
items.find({
    created_at: {
        $gte: ISODate("2010-04-29T00:00:00.000Z"),
        $lt: ISODate("2010-05-01T00:00:00.000Z")
    }
})
=> { "_id" : ObjectId("4c0791e2b9ec877893f3363b"), "name" : "example", "created_at" : "Sun May 30 2010 00:00:00 GMT+0300 (EEST)" }

Example 2: mongodb check date only without time

db.collection.aggregate([{
                $addFields: {
                    onlyDate: {
                        $dateToString: {
                            format: '%Y-%m-%d',
                            date: '$date'
                        }
                    }
                }
            }, 
            {
                $match: {
                    onlyDate: {
                        '$eq': onlyTodayDate
                    }
                }
            }
        ]);