MongoDB $second

In MongoDB, the $second aggregation pipeline operator returns the second portion of a date as a number between 0 and 59. The value can also be 60 to account for leap seconds whenever applicable.

You can optionally specify a timezone to use for the result.

The $second operator accepts either a date (as either a Date, a Timestamp, or an ObjectId), or a document that specifies the date and timezone to use.

Continue reading