Skip to main content

$addMinutes

The $addMinutes operator adds a specified number of minutes to a date object.

Input

  • An array containing a date object and a numeric number of minutes to add

Output

  • A new date object with the specified number of minutes added

Examples

Add Minutes to Date

{
  "$addMinutes": [
    {
      "$toDate": ["2023-01-15T10:30:00Z"]
    },
    45
  ]
}
Result: Date object representing January 15, 2023 at 11:15:00 UTC

Add Minutes to Field Value

{
  "$addMinutes": [
    {
      "$input": "start_time"
    },
    {
      "$input": "minutes_to_add"
    }
  ]
}
Result: A new date with minutes_to_add added to the start_time field