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