append() public method

If field exists and is not array - convert to array and append If field -s array - append
public append ( type $selector, type $value ) : Structure
$selector type
$value type
return Structure
示例#1
0
 /**
  * If field not exist - set value.
  * If field exists and is not array - convert to array and append
  * If field -s array - append
  *
  * @param type $selector
  * @param type $value
  * @return \Sokil\Mongo\Structure
  */
 public function append($selector, $value)
 {
     parent::append($selector, $value);
     // if document saved - save through update
     if ($this->getId()) {
         $this->operator->set($selector, $this->get($selector));
     }
     return $this;
 }