diff options
author | Mathias Stearn <mathias@10gen.com> | 2012-11-15 13:59:20 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2012-11-15 13:59:38 -0500 |
commit | fa283ee1d6a4900497753e807a678905d029c540 (patch) | |
tree | 6d9808caa7078ed464dc0ad69c039b082e4e181f /src/mongo/db/projection.cpp | |
parent | f3121bdcd1e330e49092287faa6b70898c973eca (diff) | |
download | mongo-fa283ee1d6a4900497753e807a678905d029c540.tar.gz |
Make Projection use StringMap
Diffstat (limited to 'src/mongo/db/projection.cpp')
-rw-r--r-- | src/mongo/db/projection.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/db/projection.cpp b/src/mongo/db/projection.cpp index 21d95000418..5e2f204de56 100644 --- a/src/mongo/db/projection.cpp +++ b/src/mongo/db/projection.cpp @@ -75,9 +75,8 @@ namespace mongo { // initialize new Matcher object(s) - _matchers.insert( make_pair( - mongoutils::str::before( e.fieldName(), '.' ), - shared_ptr<Matcher>( new Matcher( e.wrap(), true ) ) ) ); + _matchers[mongoutils::str::before(e.fieldName(), '.').c_str()] + = boost::make_shared<Matcher>(e.wrap(), true); add( e.fieldName(), true ); } else { @@ -127,9 +126,9 @@ namespace mongo { const string subfield = field.substr(0,dot); const string rest = (dot == string::npos ? "" : field.substr(dot+1,string::npos)); - boost::shared_ptr<Projection>& fm = _fields[subfield]; + boost::shared_ptr<Projection>& fm = _fields[subfield.c_str()]; if (!fm) - fm.reset(new Projection()); + fm = boost::make_shared<Projection>(); fm->add(rest, include); } @@ -147,9 +146,9 @@ namespace mongo { const string subfield = field.substr(0,dot); const string rest = (dot == string::npos ? "" : field.substr(dot+1,string::npos)); - boost::shared_ptr<Projection>& fm = _fields[subfield]; + boost::shared_ptr<Projection>& fm = _fields[subfield.c_str()]; if (!fm) - fm.reset(new Projection()); + fm = boost::make_shared<Projection>(); fm->add(rest, skip, limit); } |