diff options
author | Eliot Horowitz <eliot@10gen.com> | 2013-02-28 16:43:45 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2013-02-28 16:44:11 -0500 |
commit | 0c8ac1a52dcf0a93e6e1ab4d701215b2beb6cff6 (patch) | |
tree | f1322b1ec72f19e8f60297e8dc7a846038dff82c /src/mongo/db/index_set.cpp | |
parent | dd142e8324f977197107c9bbec62f4af3670aebd (diff) | |
download | mongo-0c8ac1a52dcf0a93e6e1ab4d701215b2beb6cff6.tar.gz |
SERVER-8758 - IndexSet fix for ab vs a
Diffstat (limited to 'src/mongo/db/index_set.cpp')
-rw-r--r-- | src/mongo/db/index_set.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mongo/db/index_set.cpp b/src/mongo/db/index_set.cpp index 4d7cb62a759..65f74ed54ea 100644 --- a/src/mongo/db/index_set.cpp +++ b/src/mongo/db/index_set.cpp @@ -47,16 +47,28 @@ namespace mongo { StringData idx( *i ); - if ( use.startsWith( idx ) ) + if ( _startsWith( use, idx ) ) return true; - if ( idx.startsWith( use ) ) + if ( _startsWith( idx, use ) ) return true; } return false; } + bool IndexPathSet::_startsWith( const StringData& a, const StringData& b ) const { + if ( !a.startsWith( b ) ) + return false; + + // make sure there is a dot or EOL right after + + if ( a.size() == b.size() ) + return true; + + return a[b.size()] == '.'; + } + bool getCanonicalIndexField( const StringData& fullName, string* out ) { // check if fieldName contains ".$" or ".###" substrings (#=digit) and skip them // however do not skip the first field even if it meets these criteria |