public function bulk($docs, $allOrNothing = false) {
    if(!$this->db) {
      throw new SagException('No database specified');
    }

    if(!is_array($docs)) {
      throw new SagException('bulk() expects an array for its first argument');
    }

    if(!is_bool($allOrNothing)) {
      throw new SagException('bulk() expects a boolean for its second argument');
    }

    $data = new stdClass();

    //Only send all_or_nothing if it's non-default (true), saving bandwidth.
    if($allOrNothing) {
      $data->all_or_nothing = $allOrNothing;
    }

    $data->docs = $docs;

    return $this->procPacket("POST", "/{$this->db}/_bulk_docs", json_encode($data));
  }
public function bulk($docs, $allOrNothing = false) {
    if(!$this->db) {
      throw new SagException('No database specified');
    }

    if(!is_array($docs)) {
      throw new SagException('bulk() expects an array for its first argument');
    }

    if(!is_bool($allOrNothing)) {
      throw new SagException('bulk() expects a boolean for its second argument');
    }

    $data = new stdClass();

    //Only send all_or_nothing if it's non-default (true), saving bandwidth.
    if($allOrNothing) {
      $data->all_or_nothing = $allOrNothing;
    }

    $data->docs = $docs;

    return $this->procPacket("POST", "/{$this->db}/_bulk_docs", json_encode($data));
  }
public function bulk ( $ docs , $ allOrNothing = false ) { if ( ! $ this -> db ) { throw new SagException ( 'No database specified' ) ; } if ( ! is_array ( $ docs ) ) { throw new SagException ( 'bulk() expects an array for its first argument' ) ; } if ( ! is_bool ( $ allOrNothing ) ) { throw new SagException ( 'bulk() expects a boolean for its second argument' ) ; } $ data = new stdClass ( ) ; //Only send all_or_nothing if it's non-default (true), saving bandwidth. if ( $ allOrNothing ) { $ data -> all_or_nothing = $ allOrNothing ; } $ data -> docs = $ docs ; return $ this -> procPacket ( "POST" , "/{$this->db}/_bulk_docs" , json_encode ( $ data ) ) ; }
Bulk pushes documents to the database.

This function does not leverage the caching mechanism you specify with
setCache().

@param array $docs An array of the documents you want to be pushed; they
can be JSON strings, objects, or arrays.
@param bool $allOrNothing Whether to treat the transactions as "all or
nothing" or not. Defaults to false.

@return mixed
Bulk pushes documents to the database .