2
我在string format 'yyyyMMdd'
中獲得date parameter
。如何在mongodb中過濾特定日期格式的查詢?
我有一個集合在mongodb中有一個屬性CallDate ISODate()
,我需要寫下一個查詢過濾日期參數。
在SQL服務器,我們只是使用查詢
select * from xyz x with (nolock)
where CONVERT(VARCHAR(23), Cast(x.CallDate as datetime), 112) = @pDateParameter
我怎麼能達到同樣過濾器MongoDB的
db.getCollection("_xyz").find({CallDate : ?}) //How to adjust that filter here
能否詳細說明$ project的用法嗎? –
帶有字段排除的項目用於刪除我們作爲聚合管道的一部分添加的額外日期字符串字段。這裏有更多信息。 https://docs.mongodb.com/manual/reference/operator/aggregation/project/#exclude-fields – Veeram