Skip to content

Commit

Permalink
adding 'exists' search constraint
Browse files Browse the repository at this point in the history
git-svn-id: http://mongodb-morph.googlecode.com/svn/trunk@126 406649b4-5d4b-11de-8abc-d1c337b90d21
  • Loading branch information
XirisR authored and XirisR committed Feb 1, 2010
1 parent 120e322 commit d193709
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions mongodb-morph/src/Morph/Query/Property.php
Expand Up @@ -76,8 +76,6 @@ public function property($propertyName)
return $this->query->property($propertyName); return $this->query->property($propertyName);
} }




////////////////////////// //////////////////////////
// CONSTRAINT FUNCTIONS // // CONSTRAINT FUNCTIONS //
////////////////////////// //////////////////////////
Expand Down Expand Up @@ -241,6 +239,18 @@ public function size($value)
return $this; return $this;
} }


/**
* 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 * Sets the sort direction if needed
* *
Expand Down

0 comments on commit d193709

Please sign in to comment.