setContent

document.setContent({newContent: 'someValue'}, true);
JSONObject content = new JSONObject().put("content", "some content");

document.setContent(content, true);
<?php

use \Kuzzle\Document;

// ...

$documentContent = [
  'field' => 'value'
];

/**
 * @var $document Document
 */
$document->setContent($documentContent);

Replaces the current content with new data.
This is a helper function returning itself, allowing to easily chain calls.


setContent(data, [replace])

ArgumentsTypeDescription
dataJSON ObjectNew content
replacebooleantrue: replace the current content with the provided data, false: merge it

Note: by default, the replace argument is set to false


Return value

Returns this Document object to allow chaining.