SDK
SDK PHP v3.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

mUpdateDocument #

Update the provided Documents.


mUpdateDocument(documents, [options], [callback]) #

ArgumentsTypeDescription
documentsDocument[]Array of Documents to update
optionsJSON ObjectOptional parameters
callbackfunctionOptional callback

Options #

OptionTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue

Return Value #

Returns the Collection object to allow chaining.


Callback Response #

Returns a JSON object containing the raw Kuzzle response. Can return a 206 partial error in cases where documents could not be updated.

Usage #

<?php
use \Kuzzle\Kuzzle;
use \Kuzzle\Document;
$kuzzle = new Kuzzle('localhost');
$dataCollection = $kuzzle->collection('collection', 'index');
$firstDocument = new Document($dataCollection, 'doc1', ['title' => 'foo', 'content' => 'bar']);
$secondDocument = new Document($dataCollection, 'doc2', ['title' => 'foo', 'content' => 'bar']);
try {
  $result = $dataCollection->mUpdateDocument([$firstDocument, $secondDocument]);
}
catch (ErrorException $e) {
}

Callback response:

{
  "hits": [{ "first": "document" }, { "second": "document" }],
  "total": 2
}