比較日期我使用UTC日期格式在我的應用程序和存儲數據如下圖所示findOne查詢在UTC
{
"_id" : ObjectId("58ef69c221f24305c0c7123b"),
"departmentId" : "58db361424f6bc2d3840f38b",
"departmentOfficerId" : "58e21f0a7fa219021cd351ca",
"departmentOfficerCurrentMonth" : NumberInt(1),
"calenderYear": 2017
"createdAt" : "Thu, 13 Apr 2017 12:06:26 GMT",
"updatedAt" : "Thu, 13 Apr 2017 12:06:26 GMT",
}
它不應該給我任何數據,但它給了我整個的數據。
,我使用下面的MongoDB查詢
db.departmentOfficerMonthlyScores.findOne(
{
departmentOfficerId: "58e21f0a7fa219021cd351ca",
departmentOfficerCurrentMonth: 1,
calenderYear: 2017,
updatedAt: { "$gte" : "Fri, 14 Apr 2017 06:33:10 GMT" }
}
)
,但是當我使用此查詢其中的日期規定的比較是在同一天
db.departmentOfficerMonthlyScores.findOne(
{
departmentOfficerId: "58e21f0a7fa219021cd351ca",
departmentOfficerCurrentMonth: 1,
calenderYear: 2017,
updatedAt: { "$gte" : "Thu, 13 Apr 2017 13:16:20 GMT" }
}
)
它給我正確的結果即空。如何處理這個問題