var mongoose = require('mongoose'), Cache, cache;
mongoose.connect('mongodb://localhost:27017/test');
Cache = mongoose.model('Cache', mongoose.Schema({
value: {},
createdAt: {type: Date, expires: 3600}
}));
cache = new Cache({
createdAt: new Date(),
value: {foo: 'bar'}
});
cache.save(function(err, obj) {
console.log(err, obj);
process.exit();
});
I'm trying to make the cache get removed after certain time. I waited for more than 3 minutes and the document I inserted did not get deleted at all. Have I missed something?