setMeta

document.setMeta({metaAttribute: 'metaValue'}, true);
JSONObject metadata = new JSONObject().put("metaAttribute", "metaValue");

document.setMeta(metadata, true);
<?php

use \Kuzzle\Document;

// ...

$metadata = [
  'metaAttribute' => 'metaValue'
];

/**
 * @var $document Document
 */
$document->setMeta($metadata);

Replaces or updates the current document metadata with provided ones.
This is a helper function returning itself, allowing to easily chain calls.


setMeta(meta, [replace])

ArgumentsTypeDescription
metaJSON ObjectNew metadata
replacebooleantrue: replaces the current metadata with the provided ones, otherwise merges it

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


Return value

Returns this Document object to allow chaining.