I want to delete a particular item from the mongo collection after a given time. I tried expireAfterSeconds using mongoose schema, expires in index of schema and different methods. Even after 60 seconds also when I refresh my mongo database the item in collection is present and after 10 mins also it is there and not getting delted automatically
I tried in two different ways
timeCreated: { type: Date, default: Date.now, expires: 20 },
admin: { type: Boolean, default: false, index : {expires: '10s'} },