有没有办法使用mongodb shell使用自定义格式将字符串转换为日期
我想转换"21/May/2012:16:35:33 -0400"到目前为止,
有没有办法通过DateFormatter或某事
Date.parse(...)或ISODate(....)方法?
我在mongo db中写了一个查询.我有一个预订表,我希望在一个月内获得预订数量,即按月分组.我很困惑,如何从约会获得月份.
这是我的架构:
{
"_id" : ObjectId("5485dd6af4708669af35ffe6"),
"bookingid" : 1,
"operatorid" : 1,
"clientid" : null,
"callername" : "Sayem Hussain",
"contactno" : "0205661862",
"regular" : 0,
"bookingdetail" : [
{
"driverid" : 1,
"pickupdatetime" : "2011-04-14 11:00:00",
"from" : "white chapel",
"to" : "beach",
"cost" : 500,
"journeytime" : 60
},
{
"driverid" : 2,
"pickupdatetime" : "2012-05-14 12:00:00",
"from" : "walthamstow",
"to" : "mile end",
"cost" : 1000,
"journeytime" : 50
}
],
"bookingdatetime" : "2012-10-11T07:00:00Z"
}
{
"_id" …Run Code Online (Sandbox Code Playgroud)