BSONTypeError: Unsupported type BigInt, please use Decimal128

I’m trying to create a sort of timer command with Discord.js and MongoDB. I currently use mongoose as the wrapper. I am also using Agenda to automatically delete the timers from the database after the specified time period.
Once the bot is ready, the bot goes through the timers from the database and the agenda jobs are postponed/executed depending on the time.

// models.timer refers to the Model from mongoose itself.
const timers = await models.timer.find();
for (const timer of timers) {
  if (Date.now() > timer.endsAt) {
    // this is logged correctly
    console.log(Date.now(), timer.endsAt, timer.id);
    await agenda.now<RemoveTimer>(AgendaJobs.RemoveTimer, {
      timerId: timer.id,
      client: this.container.client,
    });
    // this doesn't log at all
    console.log("done");
  } else
    await agenda.schedule<RemoveTimer>(
      new Date(timer.endsAt),
      AgendaJobs.RemoveTimer,
      {
        timerId: timer.id,
        client: this.container.client,
      }
    );
}

I have the Agenda job which supposedly never runs

agenda.define<RemoveTimer>(
  AgendaJobs.RemoveTimer,
  async (job: Job<RemoveTimer>) => {
    // never gets logged, code doesn't continue
    console.log("job");
    const { timerId, client } = job.attrs.data;
    console.log("job", timerId);
    const timer = await models.timer.findByIdAndDelete(timerId);
    if (!timer) return;
    const message = `Timer for **${timer.name}** has ended! <@${timer.createdBy}>`;
    if (timer.dm) {
      const channel = client.channels.cache.get(timer.channelId);
      if (channel?.type !== ChannelType.GuildText) return;
      await channel.send(message).catch(() => {});
    } else {
      await client.users.send(timer.createdBy, message).catch(() => {});
    }
  }
);

The mongoose schema:

const schema = new Schema<ITimer>({
  name: {
    type: String,
    default: "Timer",
  },
  createdBy: String,
  channelId: String,
  endsAt: Number,
  dm: {
    type: Boolean,
    default: false,
  },
});
export const TimerModel = model<ITimer>("timer", schema);

After the last successful log from the first code (which logs the current unix time, the time in which the timer ends at, and the string version of the id of the timer provided by mongoose), the code supposedly stops running, and I get this error:

2024-08-07 19:58:26 - ERROR - Encountered error on event listener "ready" for event "ready" at path "H:GitStuffnightmare-utilsdistlistenersready.js" BSONTypeError: Unsupported type BigInt, please use Decimal128
2024-08-07 19:58:26 - ERROR -     at new BSONTypeError (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonliberror.js:41:28)
2024-08-07 19:58:26 - ERROR -     at serializeInto (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonlibparserserializer.js:788:35)
2024-08-07 19:58:26 - ERROR -     at serializeObject (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonlibparserserializer.js:282:20)
2024-08-07 19:58:26 - ERROR -     at serializeInto (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonlibparserserializer.js:813:25)
2024-08-07 19:58:26 - ERROR -     at serializeObject (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonlibparserserializer.js:282:20)
2024-08-07 19:58:26 - ERROR -     at serializeInto (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonlibparserserializer.js:813:25)
2024-08-07 19:58:26 - ERROR -     at serializeObject (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonlibparserserializer.js:282:20)
2024-08-07 19:58:26 - ERROR -     at serializeInto (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonlibparserserializer.js:813:25)
2024-08-07 19:58:26 - ERROR -     at serializeObject (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonlibparserserializer.js:282:20)
2024-08-07 19:58:26 - ERROR -     at serializeInto (H:GitStuffnightmare-utilsnode_modulesmongodbnode_modulesbsonlibparserserializer.js:607:25) {
2024-08-07 19:58:26 - ERROR -   originalLine: 45,
2024-08-07 19:58:26 - ERROR -   originalColumn: 30
2024-08-07 19:58:26 - ERROR - }