64 lines
1.4 KiB
Markdown
64 lines
1.4 KiB
Markdown
db.getCollection('mdtest').insertMany(
|
|
[{item:"Record a", "createdAt": new Date()}, {item:"Record b", "createdAt": new Date()}, {item:"Record c", "deleteable": 1, "createdAt": new Date()}, {item:"Record D", "createdAt": new Date()}, {item:"Record e", "createdAt": new Date()}, {item:"Record f", "createdAt": new Date() }]
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
/* 1 */
|
|
{
|
|
"_id" : ObjectId("5ae05eda5a560b44ecfed75e"),
|
|
"item" : "Record a",
|
|
"createdAt" : ISODate("2018-04-25T10:56:26.833Z")
|
|
}
|
|
|
|
/* 2 */
|
|
{
|
|
"_id" : ObjectId("5ae05eda5a560b44ecfed75f"),
|
|
"item" : "Record b",
|
|
"createdAt" : ISODate("2018-04-25T10:56:26.833Z")
|
|
}
|
|
|
|
/* 3 */
|
|
{
|
|
"_id" : ObjectId("5ae05eda5a560b44ecfed760"),
|
|
"item" : "Record c",
|
|
"deleteable" : 1.0,
|
|
"createdAt" : ISODate("2018-04-25T10:56:26.833Z")
|
|
}
|
|
|
|
/* 4 */
|
|
{
|
|
"_id" : ObjectId("5ae05eda5a560b44ecfed761"),
|
|
"item" : "Record D",
|
|
"createdAt" : ISODate("2018-04-25T10:56:26.833Z")
|
|
}
|
|
|
|
/* 5 */
|
|
{
|
|
"_id" : ObjectId("5ae05eda5a560b44ecfed762"),
|
|
"item" : "Record e",
|
|
"createdAt" : ISODate("2018-04-25T10:56:26.833Z")
|
|
}
|
|
|
|
/* 6 */
|
|
{
|
|
"_id" : ObjectId("5ae05eda5a560b44ecfed763"),
|
|
"item" : "Record f",
|
|
"createdAt" : ISODate("2018-04-25T10:56:26.833Z")
|
|
}
|
|
|
|
```
|
|
|
|
db.getCollection('mdtest').createIndex( { "createdAt": 1 }, { expireAfterSeconds: 180, background:true } )
|
|
|
|
TTL set for 3 minutes
|
|
|
|
|
|
|
|
quickDelete: 2m
|
|
longDelete: 10m
|
|
|