diff options
Diffstat (limited to 'src/mongo/db/commands/dbhash.cpp')
-rw-r--r-- | src/mongo/db/commands/dbhash.cpp | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp index 7bb796e8af9..ab986fc2780 100644 --- a/src/mongo/db/commands/dbhash.cpp +++ b/src/mongo/db/commands/dbhash.cpp @@ -80,34 +80,22 @@ namespace mongo { } *fromCache = false; - NamespaceDetails * nsd = nsdetails( fullCollectionName ); - verify( nsd ); - - // debug SERVER-761 - NamespaceDetails::IndexIterator ii = nsd->ii(); - while( ii.more() ) { - const IndexDetails &idx = ii.next(); - if ( !idx.head.isValid() || !idx.info.isValid() ) { - log() << "invalid index for ns: " << fullCollectionName << " " << idx.head << " " << idx.info; - if ( idx.info.isValid() ) - log() << " " << idx.info.obj(); - log() << endl; - } - } + Collection* collection = cc().database()->getCollection( fullCollectionName ); + if ( !collection ) + return ""; + + IndexDescriptor* desc = collection->getIndexCatalog()->findIdIndex(); auto_ptr<Runner> runner; - int idNum = nsd->findIdIndex(); - if ( idNum >= 0 ) { - runner.reset(InternalPlanner::indexScan(fullCollectionName, - nsd, - idNum, + if ( desc ) { + runner.reset(InternalPlanner::indexScan(desc, BSONObj(), BSONObj(), false, InternalPlanner::FORWARD, InternalPlanner::IXSCAN_FETCH)); } - else if ( nsd->isCapped() ) { + else if ( collection->details()->isCapped() ) { runner.reset(InternalPlanner::collectionScan(fullCollectionName)); } else { |