I have a schema where I expire the document in 24 hours.
let mySchema = new Schema({
name: String,
createdAt: {type: Date, default: Date.now },
expire_at: {type: Date, default: Date.now, expires: 86400},
});
However, on some occasions I do not want to expire the document and then do myDocument.expire_at = null;
This seems to work and the document seems to not expire. However, are there better practices for achieving this or any problems that might occur if the document expiry is cancelled in this way?