Skip to content

Make ComplexDateTimeField useable as a TTL index #928

Open
@jimmyshen

Description

@jimmyshen

Currently, ComplexDateTimeField is not useable as a TTL index. Right now, this is stored as a simple string to enable lexicographic comparison but MongoDB itself won't be able to use it for a TTL index. I think changing the storage to an array will do the trick:

[ISODate, microsecond]  # zero out seconds/milliseconds in ISODate

This should sort properly and work with MongoDB TTL indexes per the documentation:

http://docs.mongodb.org/manual/core/index-ttl/

Backwards compatibility can be maintained by just converting data on egress to DB.

Thoughts? If everyone agrees this would be a good course, I can work on the PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions