Next.js Discord

Discord Forum

MongoDB ExpireAfterSeconds always expires after 60 seconds.

Unanswered
Kromfohrländer posted this in #help-forum
Open in Discord
Avatar
KromfohrländerOP
My code:
export type Job = {
jobDate: Date;
};

const JobSchema = new Schema(
{
jobDate: { type: Date, required: true },
}
);

JobSchema.index({ jobDate: 1 }, { expireAfterSeconds: 600000 }); // 7 days in seconds

I've done all the basics. Anyone know whats up?

2 Replies

Avatar
Komondor
did you restart your nextjs server after changing it to 600000 ?
Avatar
Komondor
or if you previously created that index with a different value for expireAfterSeconds, perhaps you need to delete that index so it will get recreated with the new 600000 value