diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-07-01 15:33:03 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-07-01 15:33:03 -0400 |
commit | f4f1291e08dc15f1dacecc87d3fd3a4c78906673 (patch) | |
tree | 2f727abcf3c900a853996a8d72335bdc2339f03d | |
parent | 6435f5f7e09edd60bc5d59328e8a5cbab88149ad (diff) | |
download | mongo-f4f1291e08dc15f1dacecc87d3fd3a4c78906673.tar.gz |
FieldMathcer::getSpec
-rw-r--r-- | db/queryutil.cpp | 7 | ||||
-rw-r--r-- | db/queryutil.h | 2 | ||||
-rw-r--r-- | s/cursors.cpp | 5 |
3 files changed, 10 insertions, 4 deletions
diff --git a/db/queryutil.cpp b/db/queryutil.cpp index 6715168618c..12fc83e0037 100644 --- a/db/queryutil.cpp +++ b/db/queryutil.cpp @@ -223,6 +223,13 @@ namespace mongo { bool FieldMatcher::matches( const string& s ) const { return baseFields.count( s ); } + + BSONObj FieldMatcher::getSpec() const{ + BSONObjBuilder b; + for ( set<string>::iterator i=baseFields.begin(); i!=baseFields.end(); i++) + b.append( i->c_str() , 1 ); + return b.obj(); + } } // namespace mongo diff --git a/db/queryutil.h b/db/queryutil.h index 77c5b416c4d..b5d964c9d2b 100644 --- a/db/queryutil.h +++ b/db/queryutil.h @@ -166,6 +166,8 @@ namespace mongo { bool matches( const string& s ) const; + BSONObj getSpec() const; + private: set<string> baseFields; }; diff --git a/s/cursors.cpp b/s/cursors.cpp index bf2fc97f496..32bc7290014 100644 --- a/s/cursors.cpp +++ b/s/cursors.cpp @@ -20,10 +20,7 @@ namespace mongo { _done = false; if ( q.fields.get() ){ - BSONObjBuilder b; - for ( set<string>::iterator i=q.fields->begin(); i!=q.fields->end(); i++) - b.append( i->c_str() , 1 ); - _fields = b.obj(); + _fields = q.fields->getSpec(); } else { _fields = BSONObj(); |