MongoDB ExpireAfterSeconds always expires after 60 seconds.
Unanswered
Kromfohrländer posted this in #help-forum
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?
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?
3 Replies
Komondor
did you restart your nextjs server after changing it to 600000 ?
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
KromfohrländerOP
Ive deleted the index and restarted the server. Someone on the mongodb discord community said to use "expires" for mongoose. Gonna try it now.