diff --git a/src/sdk-reference/collection-mapping/index.md b/src/sdk-reference/collection-mapping/index.md index 0608f03bd..3dbf20084 100644 --- a/src/sdk-reference/collection-mapping/index.md +++ b/src/sdk-reference/collection-mapping/index.md @@ -81,7 +81,4 @@ Once a field mapping has been set, it cannot be removed without reconstructing t | Property name | Type | Description | get/set | |--------------|--------|-----------------------------------|---------| -| ``headers`` | JSON Object | Common headers for all sent documents. | get/set | | ``mapping`` | object | Easy-to-understand list of mappings per field | get/set | - -**Note:** the ``headers`` property is inherited from the provided [Collection]({{ site_base_path }}sdk-reference/collection/) object and can be overrided diff --git a/src/sdk-reference/collection-mapping/set-headers.md b/src/sdk-reference/collection-mapping/set-headers.md deleted file mode 100644 index 091febf3e..000000000 --- a/src/sdk-reference/collection-mapping/set-headers.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: side-code.html -language-tab: - js: Javascript - java: Android - php: PHP -algolia: true -title: setHeaders ---- - -# setHeaders - -```js -dataMapping.setHeaders({someContent: 'someValue'}, true); -``` - -```java -JSONObject headers = new JSONObject(); -headers.put("someContent", "someValue"); -dataMapping.setHeaders(headers, true); -``` - -```php - 'someValue' -]; - -/** - * @var $dataMapping DataMapping - */ -$dataMapping->setHeaders($headers); -``` - -This is a helper function returning itself, allowing to easily chain calls. - ---- - -## setHeaders(content, [replace]) - -| Arguments | Type | Description | -|---------------|---------|----------------------------------------| -| ``content`` | JSON Object | New content | -| ``replace`` | boolean | true: 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 `CollectionMapping` object to allow chaining. diff --git a/src/sdk-reference/collection/index.md b/src/sdk-reference/collection/index.md index beddc12fe..49a59436f 100644 --- a/src/sdk-reference/collection/index.md +++ b/src/sdk-reference/collection/index.md @@ -14,11 +14,11 @@ subheader-title: Constructor # Collection ```js -let dataCollection = new Collection(kuzzle, "my-collection", "my-index") +const dataCollection = new Collection(kuzzle, "my-collection", "my-index") ``` ```java - Collection myCollection = new Collection(kuzzle, "my-collection", "my-index"); +Collection myCollection = new Collection(kuzzle, "my-collection", "my-index"); ``` ```php @@ -53,10 +53,7 @@ A data collection is a set of data managed by Kuzzle. It acts like a data table | Property name | Type | Description | get/set | |--------------|--------|-----------------------------------|---------| -| ``kuzzle`` | object | linked kuzzle instance | get | -| ``index`` | object | Name of the index containing the data collection | get | | ``collection`` | string | The name of the data collection handled by this instance | get | -| ``headers`` | object | Headers for all sent documents. | get/set | - +| ``index`` | object | Name of the index containing the data collection | get | +| ``kuzzle`` | object | linked kuzzle instance | get | -**Note:** the ``headers`` property is inherited from the main ``Kuzzle`` object and can be overrided diff --git a/src/sdk-reference/collection/set-headers.md b/src/sdk-reference/collection/set-headers.md deleted file mode 100644 index ef820746b..000000000 --- a/src/sdk-reference/collection/set-headers.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -layout: side-code.html -language-tab: - js: Javascript - java: Android - php: PHP -algolia: true -title: setHeaders ---- - -# setHeaders - -```js -kuzzle - .collection('collection', 'index') - .setHeaders({ - someContent: 'someValue', - volatile: { someVolatileData: ['with', 'some', 'values']} - }, true); -``` - -```java -JSONObject headers = new JSONObject() - .put("someContent", "someValue") - .put("volatile", new JSONObject() - .put("someVolatileData", new JSONArray() - .put("with") - .put("some") - .put("values") - ) - ); - -kuzzle - .collection("collection", "index") - .setHeaders(content, true); -``` - -```php - 'someValue' -]; - -$kuzzle = new Kuzzle('localhost'); -$dataCollection = $kuzzle->collection('collection', 'index'); -$dataCollection->setHeaders($headers, true); -``` - -This is a helper function returning itself, allowing to easily set headers while chaining calls. - ---- - -## setHeaders(content, [replace]) - -| Arguments | Type | Description | -|---------------|---------|----------------------------------------| -| ``content`` | JSON Object | New content | -| ``replace`` | boolean | true: replace the current content with the provided data, false: merge it | - -**Note:** by default, the ``replace`` argument is set to ``false`` - ---- - -## Return value - -Returns the `Collection` object to allow chaining. diff --git a/src/sdk-reference/document/index.md b/src/sdk-reference/document/index.md index 533b11c08..fb2c75255 100644 --- a/src/sdk-reference/document/index.md +++ b/src/sdk-reference/document/index.md @@ -87,12 +87,12 @@ Kuzzle handles documents, either as realtime messages or as stored documents. Do |--------------|--------|-----------------------------------|---------| | ``collection`` | string | The data collection associated to this document | get | | ``content`` | JSON Object | The content of the document | get/set | -| ``headers`` | JSON Object | Common headers for all sent documents. | get/set | | ``id`` | string | Unique document identifier | get/set | +| ``meta`` | JSON Object | Document [metadata]({{ site_base_path }}guide/essentials/document-metadata/) | get/set | | ``version`` | integer | Current document version | get | **Notes:** * setting a new value to the ``content`` property is equivalent to calling ``setContent(data, false)`` -* setting a new value to the ``id`` property will force this value for this document -* the ``headers`` property is inherited from the provided ``Collection`` object and can be overrided +* setting a new value to the ``meta`` property is equivalent to calling ``setMeta(data, false)`` +* setting a new value to the ``id`` property will create a new document after `save` is called diff --git a/src/sdk-reference/document/set-headers.md b/src/sdk-reference/document/set-headers.md deleted file mode 100644 index c0ce9af21..000000000 --- a/src/sdk-reference/document/set-headers.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: side-code.html -language-tab: - js: Javascript - java: Android - php: PHP -algolia: true -title: setHeaders ---- - -# setHeaders - -```js -document.setHeaders({someContent: 'someValue'}, true); -``` - -```java -JSONObject headers = new JSONObject().put("someContent", "someValue"); - -document.setHeaders(headers, true); -``` - -```php - 'value' -]; - -/** - * @var $document Document - */ -$document->setHeaders($headers); -``` - -This is a helper function returning itself, allowing to easily chain calls. - ---- - -## setHeaders(content, [replace]) - -| Arguments | Type | Description | -|---------------|---------|----------------------------------------| -| ``content`` | JSON Object | New content | -| ``replace`` | boolean | true: 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. diff --git a/src/sdk-reference/document/set-meta.md b/src/sdk-reference/document/set-meta.md index 9f7fd2973..5a77511b1 100644 --- a/src/sdk-reference/document/set-meta.md +++ b/src/sdk-reference/document/set-meta.md @@ -37,7 +37,7 @@ $metadata = [ $document->setMeta($metadata); ``` -Replaces or updates the current document metadata with provided ones. +Replaces or updates the current document [metadata]({{ site_base_path }}guide/essentials/document-metadata/) with the provided ones. This is a helper function returning itself, allowing to easily chain calls.