I’m trying to expire the document after one minute its been created but after creating a document it does not get deleted after one minute
const mongoose = require('mongoose');
const textSchema = new mongoose.Schema({
id: {
type: String,
required: true,
unique: true
},
text: {
type: String,
required: true,
},
createdAt: {
type: Date,
default: Date.now,
expires: '60s'
}
});
const Text = mongoose.model('Text', textSchema);
module.exports = Text;