[SERVER-27003] TTL on long value Created: 11/Nov/16  Updated: 06/Dec/22  Resolved: 13/Dec/16

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

Type: Improvement Priority: Minor - P4
Reporter: Cheng [X] Assignee: Backlog - Storage Execution Team
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Participants:

 Description   

Hi:

I'm trying to look for the reason why mongoDB does not support long (epoch timestamp.) And if there is any plan to support that in the future.

Thanks
-Cheng



 Comments   
Comment by Eric Milkie [ 13/Dec/16 ]

Hi Chen, thanks a lot for filing this improvement request. We've considered the work involved versus the benefit perceived; because you can convert your long timestamp into a Date type in your application without using strings, we don't plan on making this change.

Comment by Cheng [X] [ 18/Nov/16 ]

Hi Thomas:

The use case is that epoch timestamp is a more portable form to present the time, versus Date type will be associated with a string format in terms of de/serialization.

It will be much easier to store and use epoch timestamp (long).

Please let me know if you have more questions.

Thanks
-Cheng

Comment by Kelsey Schubert [ 18/Nov/16 ]

Hi cchenSmarttech,

Thanks for clarifying the request. I've marked this as an improvement request to be considered. It would help us, if you could share a bit more about your use case.

Thanks again,
Thomas

Comment by Cheng [X] [ 18/Nov/16 ]

Hi Thomas:

Thanks for replying. I might be a bit vague, so I'm referring to https://docs.mongodb.com/v3.2/tutorial/expire-data/#expire-documents-at-a-specific-clock-time

where in order to expire an document using the TTL index, the referenced field has to be a Date type.

For example:

considering data:

{
   message : " Hello world",
 
   expire: ISO("2016-11-18:14:00.00"), *// if we want to use TTL on the field, it has to be "Date" type*
 
  createdAt: 147890000  *// TTL index on this field does not work*
}

Comment by Kelsey Schubert [ 18/Nov/16 ]

Hi cchenSmarttech,

Maybe I am misunderstanding your question. MongoDB does support the long data type. For additional information, please see our documentation on bson data types and extended json. In addition, please note that we have the Date type.

Regards,
Thomas

Generated at Thu Feb 08 04:13:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.