diff options
author | Kyle Suarez <kyle.suarez@mongodb.com> | 2016-08-29 10:58:25 -0400 |
---|---|---|
committer | Kyle Suarez <kyle.suarez@mongodb.com> | 2016-08-29 10:58:58 -0400 |
commit | 5aa85782d7de6810954da98a01068f223dd0081a (patch) | |
tree | c9040583c9a1b120f8fadfe222d2856b6db4b13c /src/mongo/db/commands/validate.cpp | |
parent | 38e287962414f62323abb93a67c5561a0d3175b3 (diff) | |
download | mongo-5aa85782d7de6810954da98a01068f223dd0081a.tar.gz |
SERVER-25798 return appropriate views error when validating a view
Diffstat (limited to 'src/mongo/db/commands/validate.cpp')
-rw-r--r-- | src/mongo/db/commands/validate.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp index 0357a0f7bd3..0119e0db238 100644 --- a/src/mongo/db/commands/validate.cpp +++ b/src/mongo/db/commands/validate.cpp @@ -114,6 +114,11 @@ public: Lock::CollectionLock collLk(txn->lockState(), ns_string.ns(), MODE_X); Collection* collection = ctx.getDb() ? ctx.getDb()->getCollection(ns_string) : NULL; if (!collection) { + if (ctx.getDb() && ctx.getDb()->getViewCatalog()->lookup(txn, ns_string.ns())) { + errmsg = "Cannot validate a view"; + return appendCommandStatus(result, {ErrorCodes::CommandNotSupportedOnView, errmsg}); + } + errmsg = "ns not found"; return false; } |