Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mongo aggregate function count problem

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

When using a time field to do a range query on the number of count () rows, a problem was found:

Total number of doc in the collection:

Mongo > db.log.find (). Count ()

90370113

Query the number of doc smaller than ISODate ("2016-10-10T08:00:00.358Z"):

Mongo > db.log.find ({"startTime": {$lt:ISODate ("2016-10-10T08:00:00.358Z")}}) .count ()

31031319

Mongo > db.log.find ({"startTime": {$lt:ISODate ("2016-10-10T08:00:00.358Z")}}) .count ()

31030861

Mongo > db.log.find ({"startTime": {$lt:ISODate ("2016-10-10T08:00:00.358Z")}}) .count ()

31045168

Mongo > db.log.find ({"startTime": {$lt:ISODate ("2016-10-10T08:00:00.358Z")}}) .count ()

31085955

Mongo > db.log.find ({"startTime": {$lt:ISODate ("2016-10-10T08:00:00.358Z")}}) .count ()

31118025

The results of multiple queries are generally increased rather than fixed values. The problem is under way to be solved.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report