TTL Indexes by juannyG · Pull Request #660 · mongomock/mongomock

added 10 commits

August 16, 2020 18:40
* Boundary condition of expireAfterSeconds = 0 (effectively an instant expiry)
* Non-integer values are ignored
* Compound keys are ignored
* Code consolidation and helper methods for better readability
Also, include expireAfterSeconds support in create_indexes
Sync changes with raise_not_implemented feature - swap expireAt TTL for
expireAfterSeconds.
expireAt is used an example in the docs for expireAfterSeconds=0, but is not an
expected kwarg for index creation. expireAfterSeconds=0 was also already covered
in the tests.

@juannyG

pcorpet

Sync up with most recent changes
* Make expiration method protected
* Call utcnow once, instead of on every document
Also - clean up TODO comment
* Add documentation around utcnow helper method
* Use utcnow helper method in _current_date_updater method
* Add optimization for TTL index iteration
* Add TODO for get_current_timestamp and it's time usage
* Use del instead of pop when removing documents

@juannyG