summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/matcher.h
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2013-05-06 11:22:54 -0400
committerEliot Horowitz <eliot@10gen.com>2013-05-06 11:22:54 -0400
commited3efe444510137cc45e11188e23680656e22ead (patch)
treedc1d75a66e0f7bb1112adccde2994957845a6f76 /src/mongo/db/matcher/matcher.h
parentd6a2d8027f1cbc684d960b8f522e3ffb4043d6d2 (diff)
downloadmongo-ed3efe444510137cc45e11188e23680656e22ead.tar.gz
SERVER-6400: MatchExpression version of Matcher code complete.
Diffstat (limited to 'src/mongo/db/matcher/matcher.h')
-rw-r--r--src/mongo/db/matcher/matcher.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/matcher.h b/src/mongo/db/matcher/matcher.h
index 64201bd5dad..215cb99e592 100644
--- a/src/mongo/db/matcher/matcher.h
+++ b/src/mongo/db/matcher/matcher.h
@@ -21,6 +21,7 @@
#include <boost/scoped_ptr.hpp>
#include "mongo/base/disallow_copying.h"
+#include "mongo/base/status.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/matcher/expression.h"
#include "mongo/db/matcher/match_details.h"
@@ -33,11 +34,43 @@ namespace mongo {
public:
explicit Matcher2( const BSONObj& pattern );
+ /**
+ * Generate a matcher for the provided index key format using the
+ * provided full doc matcher.
+ * THIS API WILL GO AWAY EVENTUALLY
+ */
+ explicit Matcher2( const Matcher2 &docMatcher, const BSONObj &constrainIndexKey );
+
+
bool matches(const BSONObj& doc, MatchDetails* details = NULL ) const;
+ bool atomic() const;
+
+ /*
+ * this is from old mature
+ * criteria is 1 equality expression, nothing else
+ */
+ bool singleSimpleCriterion() const;
+
+ const BSONObj* getQuery() const { return &_pattern; };
+ std::string toString() const { return _pattern.toString(); }
+
+ /**
+ * @return true if this key matcher will return the same true/false
+ * value as the provided doc matcher.
+ */
+ bool keyMatch( const Matcher2 &docMatcher ) const;
+
+ static MatchExpression* spliceForIndex( const BSONObj& key,
+ const MatchExpression* full );
+
private:
const BSONObj _pattern; // this is owned by who created us
boost::scoped_ptr<MatchExpression> _expression;
+
+ static MatchExpression* _spliceForIndex( const set<std::string>& keys,
+ const MatchExpression* full );
+
};
}