diff options
author | David Storch <david.storch@10gen.com> | 2014-11-07 17:19:18 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-11-12 15:37:37 -0500 |
commit | fdc16e8d1d2346ca152528b71538942efb3ce4db (patch) | |
tree | 40283dee62d30ebb76584b81b02112455d03b9c0 /src/mongo/db/ops/delete_executor.cpp | |
parent | 578c5c5bdbf43378da11f706be0d9a54daba0929 (diff) | |
download | mongo-fdc16e8d1d2346ca152528b71538942efb3ce4db.tar.gz |
SERVER-15917 fix explain of write commands against a non-existent database
Diffstat (limited to 'src/mongo/db/ops/delete_executor.cpp')
-rw-r--r-- | src/mongo/db/ops/delete_executor.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/db/ops/delete_executor.cpp b/src/mongo/db/ops/delete_executor.cpp index b66f153dac1..655babffb1c 100644 --- a/src/mongo/db/ops/delete_executor.cpp +++ b/src/mongo/db/ops/delete_executor.cpp @@ -110,10 +110,14 @@ namespace mongo { } } - // Note that 'collection' may by NULL in the case that the collection we are trying to - // delete from does not exist. NULL 'collection' is handled by getExecutorDelete(); we - // expect to get back a plan executor whose plan is a DeleteStage on top of an EOFStage. - Collection* collection = db->getCollection(_request->getOpCtx(), ns.ns()); + // Note that 'collection' may by NULL in the case that the collection or database we are + // trying to delete from does not exist. NULL 'collection' is handled by + // getExecutorDelete(); we expect to get back a plan executor whose plan is a DeleteStage + // on top of an EOFStage. + Collection* collection = NULL; + if (db) { + collection = db->getCollection(_request->getOpCtx(), ns.ns()); + } if (collection && collection->isCapped()) { return Status(ErrorCodes::IllegalOperation, |