summaryrefslogtreecommitdiff
path: root/src/mongo/db/views/resolved_view.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/views/resolved_view.cpp')
-rw-r--r--src/mongo/db/views/resolved_view.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mongo/db/views/resolved_view.cpp b/src/mongo/db/views/resolved_view.cpp
index ec60c6f0826..244d38a0b55 100644
--- a/src/mongo/db/views/resolved_view.cpp
+++ b/src/mongo/db/views/resolved_view.cpp
@@ -183,9 +183,8 @@ AggregateCommandRequest ResolvedView::asExpandedViewAggregation(
if (request.getHint() && _timeseriesOptions) {
BSONObj original = *request.getHint();
BSONObj rewritten = original;
- // Only convert if we are given an index spec, not an index name. An index name is provided
- // in the form of {"$hint": <name>}.
- if (!original.isEmpty() && original.firstElementFieldNameStringData() != "$hint"_sd) {
+ // Only convert if we are given an index spec, not an index name or a $natural hint.
+ if (timeseries::isHintIndexKey(original)) {
auto converted = timeseries::createBucketsIndexSpecFromTimeseriesIndexSpec(
*_timeseriesOptions, original);
if (converted.isOK()) {