[SERVER-56883] db.collection.stats() errors on time-series collections on a mongos Created: 12/May/21  Updated: 29/Oct/23  Resolved: 25/May/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.9 Required
Fix Version/s: 5.0.0-rc1, 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Naomi Pentrel (Inactive) Assignee: Henrik Edin
Resolution: Fixed Votes: 0
Labels: bkp, post-rc0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Duplicate
is duplicated by SERVER-57124 Running collStats command on mongos f... Closed
Related
related to SERVER-57196 Add test for running db.collection.st... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0
Steps To Reproduce:

Enterprise [direct: mongos]>    db.createCollection(
...        "weather25h",
...        {
.....           timeseries: {
.......              timeField: "timestamp",
.......              metaField: "metadata",
.......              expireAfterSeconds: 86400
.......           }
.....        }
...    )
{ ok: 1 }
Enterprise [direct: mongos]> db.weather25h.find()
Enterprise [direct: mongos]> db.weather25h.stats()
MongoError: expected  to have a numeric type, but it is a missing
Enterprise [direct: mongos]> db.weather25h.insert({})
MongoBulkWriteError: 'timestamp' must be present an contain a valid BSON UTC datetime value
Enterprise [direct: mongos]> db.weather25h.insert(\{timestamp: new Date()})
{
  acknowledged: true,
  insertedIds: \{ '0': ObjectId("609ab1ae1ab8fa361309e039") }
}
Enterprise [direct: mongos]> db.weather25h.findOne()
{
  timestamp: 2021-05-11T16:32:46.642Z,
  metadata: null,
  _id: ObjectId("609ab1ae1ab8fa361309e039")
}
Enterprise [direct: mongos]> db.weather25h.stats()
MongoError: expected  to have a numeric type, but it is a missing
Enterprise [direct: mongos]>

Sprint: Execution Team 2021-05-31
Participants:

 Description   

Running this on mongodb-macos-x86_64-enterprise-4.9.0-alpha7-187-g388ce13.

geert.bosch says this may be because the mongos does validation on the count field which is not present for time-series collections.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 25/May/21 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-56883 Fix db.collection.stats() error on mongos when calling on timeseries collection

(cherry picked from commit c09e27d0ea8b535a3a766924c141116c801f641a)
Branch: v5.0
https://github.com/mongodb/mongo/commit/bb8cf8713da57232a3a6522db8bd755cf490c76f

Comment by Githook User [ 25/May/21 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-56883 Fix db.collection.stats() error on mongos when calling on timeseries collection
Branch: master
https://github.com/mongodb/mongo/commit/c09e27d0ea8b535a3a766924c141116c801f641a

Generated at Thu Feb 08 05:40:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.