diff options
author | Dwight <dmerriman@gmail.com> | 2009-01-27 15:35:28 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2009-01-27 15:35:28 -0500 |
commit | 83c1dbb1c275f05eff2f611cb47624897c00de3e (patch) | |
tree | 9e7df11b374be183dfaec60faed9da5fbd1471e8 /db/dbhelpers.cpp | |
parent | df7c7536404ea531b8253541fedb4f51098d7bb1 (diff) | |
download | mongo-83c1dbb1c275f05eff2f611cb47624897c00de3e.tar.gz |
check the index range first before we go into the object on a query -- so we don't hit disk unnecessarily
fix index4.js test
check on index creation that index key pattern is ok
Diffstat (limited to 'db/dbhelpers.cpp')
-rw-r--r-- | db/dbhelpers.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/db/dbhelpers.cpp b/db/dbhelpers.cpp index 8a1996f2025..822d6d77ff0 100644 --- a/db/dbhelpers.cpp +++ b/db/dbhelpers.cpp @@ -60,16 +60,19 @@ namespace mongo { c = DataFileMgr::findAll(ns); } + if( !c->ok() ) + return false; + JSMatcher matcher(query, c->indexKeyPattern()); - while ( c->ok() ) { + do { BSONObj js = c->current(); if( matcher.matches(js) ) { result = js; return true; } c->advance(); - } + } while( c->ok() ); return false; } |