TypeError: this._pres.keys is not a function or its return value is not iterable

Getting this error when trying to store the time a user visits a website in mongodb.

Here is the schema for impressions (time_of_day is where the date of when the user visits the website is stored)

const mongoose = require("mongoose");
mongoose.Schema.Types.ObjectId;
const ImpressionsSchema = new mongoose.Schema({
    impression_id:{
        type: mongoose.Schema.Types.ObjectId,
        required:true,
    },
    rating:{
        type:Number,
        required:false,
    },
    comments:{
        type:String,
        required:false,
    },
    photo:{
        type:String,
        required:false, // string will be the URL pointing to the image stored externally
    },
    time_spent:{
        type:Number,
        required:false,
    },
    time_of_day:{
        type:Date,
        required:true,
    },
})

module.exports = Impressions = mongoose.model('impressions', ImpressionsSchema);

Here is the express route

const ObjectId = require("mongodb").ObjectId;
const Impressions = require('../models/Impressions');

router.post('/create', (req, res) => {
  const impressionData = {
      ...req.body,
      impression_id: new mongoose.Types.ObjectId(),
      time_of_day: new Date(req.body.time_of_day) // ensure time_of_day is a Date object
  };

  // create a new impression instance with the provided data
  const impression = new Impressions(impressionData);

  // save the impression to the database
  impression.save()
      .then(doc => res.status(200).json(doc))
      .catch(err => res.status(500).json({ error: err }));
});

module.exports = router;

And here is where im getting the visit time using react useEffect

useEffect(() => { // useEffect hook for tracking the visit
  const time_of_day = new Date(); // capture the visit time
  axios.post('/api/impressions/create', { time_of_day }) // make sure the endpoint matches your server's
    .then(response => {
      console.log('Visit time recorded:', response.data); // success :P
    })
    .catch(error => {
      console.error('Error recording visit time:', error); // error :<
    });
}, []); // empty dependency array ensures this runs once on mount

From the full error message below, it seems to be an internal error in mongoose, but I’ve tried reinstalling dependencies and it did not fix anything. Is anyone else getting this error or know anything I could try to fix it?

TypeError: this._pres.keys is not a function or its return value is not iterable
[0]     at Kareem.clone (C:\Users\zhswi\OneDrive\Documents\GCM\server\node_modules\kareem\index.js:583:32)
[0]     at Function.compile (C:\Users\zhswi\OneDrive\Documents\GCM\server\node_modules\mongoose\lib\model.js:4786:32)
[0]     at Mongoose._model (C:\Users\zhswi\OneDrive\Documents\GCM\server\node_modules\mongoose\lib\mongoose.js:620:27)
[0]     at Mongoose.model (C:\Users\zhswi\OneDrive\Documents\GCM\server\node_modules\mongoose\lib\mongoose.js:579:27)
[0]     at Object.<anonymous> (C:\Users\zhswi\OneDrive\Documents\GCM\server\models\Impressions.js:30:41)
[0]     at Module._compile (node:internal/modules/cjs/loader:1368:14)
[0]     at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
[0]     at Module.load (node:internal/modules/cjs/loader:1205:32)
[0]     at Module._load (node:internal/modules/cjs/loader:1021:12)
[0]     at Module.require (node:internal/modules/cjs/loader:1230:19)