meteor-astronomy
meteor-astronomy copied to clipboard
Adding TTL to select fields
Adding TTL via fields in a Class, so Mongo knows when to auto delete them after sometime?! Just a suggestion...
You should be able to create such an index. Try this:
import { Class } from 'meteor/jagi:astronomy';
const Item = Class.create({
name: 'Item',
collection: Items
fields: {
lastModifiedDate: Date
},
indexes: {
lastModifiedDate: { // Index name.
fields: { // List of fields.
lastModifiedDate: 1
},
options: { // Mongo index options.
expireAfterSeconds: 3600
}
}
}
});
Thanks! You rock!
On Mar 12, 2017 7:42 PM, "jagi" [email protected] wrote:
You should be able to create such an index. Try this:
import { Class } from 'meteor/jagi:astronomy'; const Item = Class.create({ name: 'Item', collection: Items fields: { lastModifiedDate: Date }, indexes: { lastModifiedDate: { // Index name. fields: { // List of fields. lastModifiedDate: 1 }, options: { // Mongo index options. expireAfterSeconds: 3600 } } } });
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jagi/meteor-astronomy/issues/598#issuecomment-285964816, or mute the thread https://github.com/notifications/unsubscribe-auth/ADoalJxKyA1yy_q4z9DOMdOqvAHYwYYOks5rlDydgaJpZM4MaKof .