Permalink
Browse files

adding 'exists' search constraint

git-svn-id: http://mongodb-morph.googlecode.com/svn/trunk@126 406649b4-5d4b-11de-8abc-d1c337b90d21
  • Loading branch information...
1 parent 120e322 commit d1937099f90c690ac2ebf381ebe779c6de9597fd XirisR committed Feb 1, 2010
Showing with 12 additions and 2 deletions.
  1. +12 −2 mongodb-morph/src/Morph/Query/Property.php
@@ -76,8 +76,6 @@ public function property($propertyName)
return $this->query->property($propertyName);
}
-
-
//////////////////////////
// CONSTRAINT FUNCTIONS //
//////////////////////////
@@ -242,6 +240,18 @@ public function size($value)
}
/**
+ * Adds a constraint that a property must exist or not
+ *
+ * @param boolean $exists
+ * @return Morph_Query_Property
+ */
+ public function exists($exists = true)
+ {
+ $this->addCompoundConstraint('$exists', (bool)$exists);
+ return $this;
+ }
+
+ /**
* Sets the sort direction if needed
*
* @param $direction

0 comments on commit d193709

Please sign in to comment.