-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The following problem is already fixed for viewless timeseries (SERVER-103426) but it's still present for legacy (view + bucket) timeseries. **
Context
$listCatalog can run both collectionless against the `admin` database or non-collectionless against a primary nss.
For the latter, the $listCatalog will report only the catalog entry for the nss.
Problem
While we support non-collectionless $listCatalog
Enterprise [direct: mongos] test> db.collection.aggregate([{$listCatalog: {}}]).toArray();
[
{
db: 'test',
name: 'collection',
type: 'collection',
shard: 'shard01',
md: {
ns: 'test.collection',
options: { uuid: UUID('935bf291-aaaa-4281-80ec-0c25163ff34d') },
indexes: [
{
spec: { v: 2, key: { _id: 1 }, name: '_id_' },
ready: true,
multikey: false,
multikeyPaths: { _id: Binary.createFromBase64('AA==', 0) }
}
]
},
idxIdent: { _id_: 'index-c9980108-7ed4-4ebc-909d-6ea46f8d180a' },
ident: 'collection-e47a4d84-b10d-431e-9f2e-83f3634468af',
ns: 'test.collection'
}
]
When running against a timeseries, the command will oddly fail claming not to be the first stage
Enterprise [direct: mongos] test> db.createCollection("timeseries_coll", {timeseries: {timeField: "t"}}) { ok: 1 } Enterprise [direct: mongos] test> db.timeseries_coll.aggregate([{$listCatalog: {}}]).toArray(); MongoServerError[Location40602]: $listCatalog is only valid as the first stage in a pipeline
Timeseries always append `$_internalUnpackBucket`as first stage and as a consequence $listCatalog will silently become the second.
$listCatalog is not the first stage that suffer this problem. Metadata stages that require to be first (such as $collStats ) already omit the $_internalUnpackBucket
My suggestion would be to apply a similar solution here.
- is related to
-
SERVER-103426 Do not inject $_internalUnpackBucket stage for pipelines that do not return buckets documents
-
- Closed
-