summaryrefslogtreecommitdiff
path: root/src/mongo/s/strategy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/strategy.cpp')
-rw-r--r--src/mongo/s/strategy.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/s/strategy.cpp b/src/mongo/s/strategy.cpp
index 784bca5c545..1cdbff82fab 100644
--- a/src/mongo/s/strategy.cpp
+++ b/src/mongo/s/strategy.cpp
@@ -87,7 +87,11 @@ namespace mongo {
static bool doShardedIndexQuery(Request& r, const QuerySpec& qSpec) {
// Extract the ns field from the query, which may be embedded within the "query" or
// "$query" field.
- const NamespaceString indexNSSQuery(qSpec.filter()["ns"].str());
+ auto nsField = qSpec.filter()["ns"];
+ if (nsField.eoo()) {
+ return false;
+ }
+ const NamespaceString indexNSSQuery(nsField.str());
auto status = grid.catalogCache()->getDatabase(indexNSSQuery.db().toString());
if (!status.isOK()) {