MongoDB Date Operators
MongoDB date operators are a set of special operators used for handling date type fields. They can be used for formatting, converting, and comparing dates in both aggregation and regular queries. This page summarizes the date operators available in MongoDB.
- 
            $dateFromParts$dateFromPartsis a date operator in MongoDB that can be used to combine the given date components (such as year, month, day, etc.) into a date object.
- 
            $dateFromString$dateFromStringis a MongoDB aggregation operator used to convert a string into a date object.
- 
            $dateToPartsThe MongoDB$dateToPartsoperator can convert dates to corresponding parts such as year, month, day, etc., to enable more flexible data processing and aggregation operations.
- 
            $dateToStringThe MongoDB$dateToStringoperator is used to convert a date field to a string and format the date into a specified string format.
- 
            $dayOfMonthThe MongoDB$dayOfMonthoperator is an aggregation expression used to extract the day of the month (1-31) from a date field.
- 
            $dayOfWeek$dayOfWeekis an aggregation operator in MongoDB used to extract the day of the week information from a date value.
- 
            $dayOfYearThe$dayOfYearoperator is one of the date operators in MongoDB’s aggregation pipeline.
- 
            $hourThe MongoDB$houroperator is an aggregation operator used to extract the hour portion from a datetime value.
- 
            $isoDayOfWeekThe MongoDB$isoDayOfWeekoperator is an aggregation operator used to extract the day of the week in ISO standard from a date-time value.
- 
            $isoWeekThe MongoDB$isoWeekoperator can be used to process and filter date data.
- 
            $isoWeekYearIn MongoDB,$isoWeekYearis an aggregation operator used to retrieve the year of an ISO week date.
- 
            $millisecondIn MongoDB, the$millisecondoperator is used to extract the millisecond portion from a date.
- 
            $minuteThe$minuteoperator is a date operator in MongoDB used to extract the minute portion from a date.
- 
            $month$monthoperator is a date operator in MongoDB aggregation pipeline, which extracts the month from a date field and can be used in aggregation operations.
- 
            $second$secondis one of the date operators in MongoDB used to handle datetime types.
- 
            $weekIn MongoDB, the$weekoperator can be used to extract the week number from a date field.
- 
            $yearThe$yearoperator is one of the operators used to manipulate date-time types and extract the year from a date-time field.
- 
            Date()In MongoDB, theDate()method can be used to create a JavaScript Date object that represents a date and time.