From fa283ee1d6a4900497753e807a678905d029c540 Mon Sep 17 00:00:00 2001 From: Mathias Stearn Date: Thu, 15 Nov 2012 13:59:20 -0500 Subject: Make Projection use StringMap --- src/mongo/db/projection.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/mongo/db/projection.cpp') 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( new Matcher( e.wrap(), true ) ) ) ); + _matchers[mongoutils::str::before(e.fieldName(), '.').c_str()] + = boost::make_shared(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& fm = _fields[subfield]; + boost::shared_ptr& fm = _fields[subfield.c_str()]; if (!fm) - fm.reset(new Projection()); + fm = boost::make_shared(); 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& fm = _fields[subfield]; + boost::shared_ptr& fm = _fields[subfield.c_str()]; if (!fm) - fm.reset(new Projection()); + fm = boost::make_shared(); fm->add(rest, skip, limit); } -- cgit v1.2.1