[SERVER-78732] $collStats output does not include 'sharded' field Created: 06/Jul/23  Updated: 07/Feb/24

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Dmitry Rybakov Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 0
Labels: PM-3364-Milestone-5, oldshardingemea
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by MONGOID-5628 Remove currentOp/collStats commands Blocked
Assigned Teams:
Catalog and Routing
Operating System: ALL
Steps To Reproduce:

Connect to a cluster using mongosh, and execute the following commands to confirm the issue:

Enterprise [mongos] test> db.runCommand({collStats: 'users'})
{
  sharded: false,
  // Full output omitted
}
 
Enterprise [mongos] test> db.users.aggregate([{$collStats: {}}])
[
  {
    ns: 'test.users',
    shard: 'shard01',
    host: 'iceberg:27019',
    localTime: ISODate("2023-07-06T15:42:43.880Z")
  }
]
 
Enterprise [mongos] test> var resp = db.users.aggregate([{$collStats: {storageStats: {}}}]).next();Enterprise [mongos] test> Object.keys(resp);
[ 'ns', 'shard', 'host', 'localTime', 'storageStats' ]
Enterprise [mongos] test> Object.keys(resp['storageStats']);
[
  'size',        'count',
  'avgObjSize',  'numOrphanDocs',
  'storageSize', 'freeStorageSize',
  'capped',      'wiredTiger',
  'nindexes',    'indexDetails',
  'indexBuilds', 'totalIndexSize',
  'indexSizes',  'totalSize',
  'scaleFactor'
] 

Participants:

 Description   

Output of the collStats command includes a boolean field sharded, which is true is the collection is sharded, and false otherwise.

$collStats aggregation, that should be used instead of the deprecated collStats command does not include this field.

Some products, including Mongoid and Doctrine ODMs relies on this field to detect whether a collection is sharded. We should have this field in the output of $collStats aggregation.


Generated at Thu Feb 08 06:39:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.