Public Member Functions | |
| def | __eq__ |
| def | __init__ |
| def | __ne__ |
| def | __repr__ |
| def | as_datetime |
| def | inc |
| def | time |
Private Attributes | |
| __inc | |
| __time | |
MongoDB internal timestamps used in the opLog.
Definition at line 24 of file bson/timestamp.py.
| def bson::timestamp::Timestamp::__eq__ | ( | self, | ||
| other | ||||
| ) |
Definition at line 77 of file bson/timestamp.py.
| def bson::timestamp::Timestamp::__init__ | ( | self, | ||
| time, | ||||
| inc | ||||
| ) |
Create a new :class:`Timestamp`.
This class is only for use with the MongoDB opLog. If you need
to store a regular timestamp, please use a
:class:`~datetime.datetime`.
Raises :class:`TypeError` if `time` is not an instance of
:class: `int` or :class:`~datetime.datetime`, or `inc` is not
an instance of :class:`int`. Raises :class:`ValueError` if
`time` or `inc` is not in [0, 2**32).
:Parameters:
- `time`: time in seconds since epoch UTC, or a naive UTC
:class:`~datetime.datetime`, or an aware
:class:`~datetime.datetime`
- `inc`: the incrementing counter
.. versionchanged:: 1.7
`time` can now be a :class:`~datetime.datetime` instance.
Definition at line 28 of file bson/timestamp.py.
| def bson::timestamp::Timestamp::__ne__ | ( | self, | ||
| other | ||||
| ) |
Definition at line 83 of file bson/timestamp.py.
| def bson::timestamp::Timestamp::__repr__ | ( | self | ) |
Definition at line 86 of file bson/timestamp.py.
| def bson::timestamp::Timestamp::as_datetime | ( | self | ) |
Return a :class:`~datetime.datetime` instance corresponding to the time portion of this :class:`Timestamp`. .. versionchanged:: 1.8 The returned datetime is now timezone aware.
Definition at line 89 of file bson/timestamp.py.
| def bson::timestamp::Timestamp::inc | ( | self | ) |
Get the inc portion of this :class:`Timestamp`.
Definition at line 72 of file bson/timestamp.py.
| def bson::timestamp::Timestamp::time | ( | self | ) |
Get the time portion of this :class:`Timestamp`.
Definition at line 66 of file bson/timestamp.py.
bson::timestamp::Timestamp::__inc [private] |
Definition at line 63 of file bson/timestamp.py.
bson::timestamp::Timestamp::__time [private] |
Definition at line 62 of file bson/timestamp.py.