Automatic Expiry For A Document In Mongodb

[Solved] Automatic Expiry For A Document In Mongodb | Perl - Code Explorer | yomemimo.com
Question : automatic expiry for a document in mongodb

Answered by : annoying-anaconda-2395j7qwv955

 > db.notifications.createIndex({"createdAt":1,"text":1}, {expireAfterSeconds:86400}) { "operationTime" : Timestamp(1599925286, 1), "ok" : 0, "errmsg" : "TTL indexes are single-field indexes, compound indexes do not support TTL. Index spec: { key: { createdAt: 1.0, text: 1.0 }, name: \"createdAt_1_text_1\", expireAfterSeconds: 86400.0 }", "code" : 67, "codeName" : "CannotCreateIndex", "$clusterTime" : { "clusterTime" : Timestamp(1599925286, 1), "signature" : { "hash" : BinData(0,"mCmm0gKiYCSNIpYEggT3LloGKdw="), "keyId" : NumberLong("6848960729458933762") } } }

Source : https://dev.to/sks147/mongodb-auto-expire-documents-6c9 | Last Update : Mon, 15 Nov 21

Answers related to automatic expiry for a document in mongodb

Code Explorer Popular Question For Perl