Mongoose is not showing the ISODate in the result I am using mongodb version 4.2.2.
I have following data:
{
    &quot;_id&quot; : ObjectId(&quot;5f0c58089c058304f7a64fa9&quot;),
    &quot;date&quot; : ISODate(&quot;2021-07-11T00:00:00.000Z&quot;),
    &quot;dayOfWeek&quot; : 0,
    &quot;staffMember&quot; : ObjectId(&quot;5f0c58076b559419d62efe47&quot;),
    &quot;startTime&quot; : 885
},

/* 2 createdAt:2020-07-13T12:48:08.000Z*/
{
    &quot;_id&quot; : ObjectId(&quot;5f0c58089c058304f7a64fa8&quot;),
    &quot;date&quot; : ISODate(&quot;2021-07-11T00:00:00.000Z&quot;),
    &quot;dayOfWeek&quot; : 0,
    &quot;staffMember&quot; : ObjectId(&quot;5f0c58076b559419d62efe47&quot;),
    &quot;startTime&quot; : 870
},

/* 3 createdAt:2020-07-13T12:48:08.000Z*/
{
    &quot;_id&quot; : ObjectId(&quot;5f0c58089c058304f7a64fa7&quot;),
    &quot;date&quot; : ISODate(&quot;2021-07-11T00:00:00.000Z&quot;),
    &quot;dayOfWeek&quot; : 0,
    &quot;staffMember&quot; : ObjectId(&quot;5f0c58076b559419d62efe47&quot;),
    &quot;startTime&quot; : 855
},

/* 4 createdAt:2020-07-13T12:48:08.000Z*/
{
    &quot;_id&quot; : ObjectId(&quot;5f0c58089c058304f7a64fa6&quot;),
    &quot;date&quot; : ISODate(&quot;2021-07-11T00:00:00.000Z&quot;),
    &quot;dayOfWeek&quot; : 0,
    &quot;staffMember&quot; : ObjectId(&quot;5f0c58076b559419d62efe47&quot;),
    &quot;startTime&quot; : 840
}

I am using mongoose in my project. When I run this query in node js:
const { memberId, date } = req.params;
let isoDate = date.toISOString();
let timeSlots = await TimeSlots.find(
{
  staffMember: memberId,
  date: isoDate 
});

The result printed on the console:
db.spaTimeSlots.find({&quot;staffMember&quot; : ObjectId(&quot;5f0c58076b559419d62efe47&quot;), date: new Date(&quot;Wed, 11 Jul 2020 00:00:00 GMT&quot;)})
   .projection({})
   .sort({_id:-1})
   .limit(100)

However, I want this result:
db.spaTimeSlots.find({&quot;staffMember&quot; : ObjectId(&quot;5f0c58076b559419d62efe47&quot;), date: ISODate(&quot;2021-07-11T00:00:00.000Z&quot;)})
   .projection({})
   .sort({_id:-1})
   .limit(100)

I want the result returned with the date in ISODate format, not as text (i.e. not Wed, 11 Jul).
You need to add like this:
let date = new Date().toISOString();
let isoDate = new Date(date);

Hope it works.