如何从 MongoDB 集合中时间 (HH:MM:SS.Milisecond) 值大于零的日期字段中选择记录,并通过保留日期将时间 (HH:MM:SS) 值更新为零值与 Python 脚本中的现有值相同吗?
当前数据如下所示 -
1) "createdDate" : ISODate("2015-10-10T00:00:00Z")
2) "createdDate" : ISODate("2015-10-11T00:00:00Z")
3) "createdDate" : ISODate("2015-10-12T00:00:00Z")
4) "createdDate" : ISODate("2015-10-13T01:04:30.515Z")
5) "createdDate" : ISODate("2015-10-14T02:05:50.516Z")
6) "createdDate" : ISODate("2015-10-15T03:06:60.517Z")
7) "createdDate" : ISODate("2015-10-16T04:07:80.518Z")
Run Code Online (Sandbox Code Playgroud)
如何在 Python 脚本中使用仅选择第 4、5、6 和 7 行mongodbsql并将其更新为时间戳为零?
更新后,数据将如下所示 -
1) "createdDate" : ISODate("2015-10-10T00:00:00Z")
2) "createdDate" : ISODate("2015-10-11T00:00:00Z")
3) "createdDate" : ISODate("2015-10-12T00:00:00Z")
4) "createdDate" : ISODate("2015-10-13T00:00:00Z")
5) "createdDate" : ISODate("2015-10-14T00:00:00Z")
6) "createdDate" : ISODate("2015-10-15T00:00:00Z")
7) "createdDate" : ISODate("2015-10-16T00:00:00Z")
Run Code Online (Sandbox Code Playgroud)