Articles → MONGODB → $Isoweekyear Operator In Mongodb

$Isoweekyear Operator In Mongodb






Purpose





What Is A Week-Year?






DateWeekday
29-Dec-2014Monday
30-Dec-2014Tuesday
31-Dec-2014Wednesday
01-Jan-2015Thursday
02-Jan-2015Friday
03-Jan-2015Saturday
04-Jan-2015Sunday





Example




Picture showing the sample document collection




db.sales.aggregate([
   {
      $addFields: {
         isoWeekYear: { $isoWeekYear: "$date" }
      }
   }
])



Output


Picture showing the output of $isoweekyear operator in mongodb



Posted By  -  Karan Gupta
 
Posted On  -  Thursday, June 6, 2024

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250