summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/write_commands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands/write_commands.cpp')
-rw-r--r--src/mongo/db/commands/write_commands.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/commands/write_commands.cpp b/src/mongo/db/commands/write_commands.cpp
index e45b7876c8a..d021b9bacc4 100644
--- a/src/mongo/db/commands/write_commands.cpp
+++ b/src/mongo/db/commands/write_commands.cpp
@@ -117,6 +117,9 @@ bool isTimeseries(OperationContext* opCtx, const Request& request) {
"system.buckets namespace",
!request.getIsTimeseriesNamespace() ||
request.getNamespace().isTimeseriesBucketsCollection());
+ const auto bucketNss = request.getIsTimeseriesNamespace()
+ ? request.getNamespace()
+ : request.getNamespace().makeTimeseriesBucketsNamespace();
// If the buckets collection exists now, the time-series insert path will check for the
// existence of the buckets collection later on with a lock.
@@ -124,11 +127,9 @@ bool isTimeseries(OperationContext* opCtx, const Request& request) {
// collection does not yet exist, this check may return false unnecessarily. As a result, an
// insert attempt into the time-series namespace will either succeed or fail, depending on who
// wins the race.
- return request.getIsTimeseriesNamespace() ||
- CollectionCatalog::get(opCtx)
- ->lookupCollectionByNamespaceForRead(
- opCtx, request.getNamespace().makeTimeseriesBucketsNamespace())
- .get();
+ return CollectionCatalog::get(opCtx)
+ ->lookupCollectionByNamespaceForRead(opCtx, bucketNss)
+ .get();
}
NamespaceString makeTimeseriesBucketsNamespace(const NamespaceString& nss) {