summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Banala <arun.banala@mongodb.com>2021-10-20 11:55:19 +0100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-11-17 10:45:04 +0000
commiteb30abacf9a89a141feb07971777fec892265f41 (patch)
treeb5dfafdc0bbee0160c8e49c7b08a35ae493ef022
parenta96a30f357990094f7e7b464cc143cab05716238 (diff)
downloadmongo-eb30abacf9a89a141feb07971777fec892265f41.tar.gz
SERVER-61039 Make sharded time-series listIndexes report the view's namespace
(cherry picked from commit e2089fc73a76db6bcf2ca2729e7e886258d3ad2f)
-rw-r--r--jstests/sharding/timeseries_indexes.js10
-rw-r--r--src/mongo/db/commands/list_indexes.cpp2
2 files changed, 10 insertions, 2 deletions
diff --git a/jstests/sharding/timeseries_indexes.js b/jstests/sharding/timeseries_indexes.js
index bb0db01231c..7d36f70829a 100644
--- a/jstests/sharding/timeseries_indexes.js
+++ b/jstests/sharding/timeseries_indexes.js
@@ -102,7 +102,11 @@ function generateDoc(time, metaValue) {
assert.commandWorked(coll.createIndex({[subField1]: 1}));
assert.commandWorked(coll.createIndex({[subField2]: 1}));
- let indexKeys = coll.getIndexes().map(x => x.key);
+
+ const listIndexesOutput = assert.commandWorked(coll.runCommand({listIndexes: coll.getName()}));
+ assert.eq(coll.getFullName(), listIndexesOutput.cursor.ns, listIndexesOutput);
+
+ let indexKeys = listIndexesOutput.cursor.firstBatch.map(x => x.key);
assert.sameMembers([{[subField1]: 1}, {[subField2]: 1}, {[timeField]: 1}, {[metaField]: 1}],
indexKeys);
@@ -122,6 +126,10 @@ function generateDoc(time, metaValue) {
// Verify that running the commands on the buckets collection should work.
const bucketsColl = mongosDB.getCollection(`system.buckets.${collName}`);
+ const outputOnBucketsColl =
+ assert.commandWorked(bucketsColl.runCommand({listIndexes: bucketsColl.getName()}));
+ assert.eq(bucketsColl.getFullName(), outputOnBucketsColl.cursor.ns, outputOnBucketsColl);
+
assert.commandWorked(bucketsColl.dropIndex({'meta.subField1': 1}));
indexKeys = bucketsColl.getIndexes().map(x => x.key);
assert.sameMembers([{'control.min.time': 1}], indexKeys);
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index c9a42882944..79c36af16ab 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -92,7 +92,7 @@ IndexSpecsWithNamespaceString getIndexSpecsWithNamespaceString(OperationContext*
timeseries::createTimeseriesIndexesFromBucketsIndexes(
*timeseriesOptions,
listIndexesInLock(opCtx, coll, bucketsNss, cmd.getIncludeBuildUUIDs())),
- *origNss);
+ bucketsNss.getTimeseriesViewNamespace());
}
}