Is there a way to configure the collection in MongoDb to automatically expire MeteorJS? I saw how to do this from the Mongo website , but was not sure how to do it from Meteor:
Tasks.insert({
text: text,
createdAt: new Date(),
});
Tasks.ensureIndex( { "createdAt": 1 }, { expireAfterSeconds: 2 } );
Tasks._ensureIndex( { "createdAt": 1 }, { expireAfterSeconds: 2 } );
Tasks.createIndex( { "createdAt": 1 }, { expireAfterSeconds: 2 } );
source
share