网站首页 文章专栏 mongo 时间参数表示
mongo 时间参数表示
编辑时间:2018年1月5日 15:18 作者:赵彦昌 浏览量:537
db.sales.aggregate(
   [
     {
       $project:
         {
           year: { $year: "$date" },
           month: { $month: "$date" },
           day: { $dayOfMonth: "$date" },
           hour: { $hour: "$date" },
           minutes: { $minute: "$date" },

           seconds: { $second: "$date" },

           milliseconds: { $millisecond: "$date" },
           dayOfYear: { $dayOfYear: "$date" },
           dayOfWeek: { $dayOfWeek: "$date" },
           week: { $week: "$date" }
         }
     }
   ]
)
来说两句吧
最新评论