I'm using mongoose with node.js. I was testing Time-To-Live features and set my documents to expire after X time in the db schema:
var adInfos = new mongoose.Schema({
inf : { type: Object, required: false },
created: { type: Date, default: Date.now, expires:60 }
});
This seems to work right but after removing the expires attribute the new documents still seem to be expiring.
I have also tried setting expires: false and expires:0 but that doesn't work either.
Mongoose doesn't ever drop indexes, so if you change the index attributes in your schema they won't take effect until after you manually drop the existing index.
Not sure what your collection name is, but in the shell it would be something like:
db.adInfos.dropIndex('created_1')
Use db.adInfos.getIndexes() to see the indexes on the collection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With