[SERVER-7309] Can't get time to live (TTL) collections working Created: 09/Oct/12  Updated: 15/Feb/13  Resolved: 09/Oct/12

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Blocker - P1
Reporter: Mark Watson Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS X 64 bit


Participants:

 Description   

Starting with a new database:

> db.cstats.ensureIndex(

{ "Date": 1 }

,

{ expireAfterSeconds: 10 }

)

> db.cstats.insert(

{"name": "test1", "Date":Date()}

)

> db.cstats.find()

{ "_id" : ObjectId("506f11bc9bf1fda81870da0a"), "name" : "test1", "Date" : "Fri Oct 05 2012 09:58:36 GMT-0700 (MST)" }

This doc never gets deleted.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 09/Oct/12 ]

Date() returns a String, not a date type.
You need to use "new Date()"

Generated at Thu Feb 08 03:14:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.