Skip to content

Commit 03d2fd1

Browse files
committed
Merge branch '7-dev' into feat/semantic-release
2 parents 92ab29c + 2257670 commit 03d2fd1

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed

doc/7/controllers/document/delete-fields/snippets/deleteFields.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: document#delete
2-
description: Deletes a document from kuzzle
2+
description: Deletes a field from a document in kuzzle
33
hooks:
44
before: |
55
curl -XDELETE kuzzle:7512/nyc-open-data
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
code: true
3+
type: page
4+
title: exists
5+
description: Check if a document exists inside kuzzle
6+
---
7+
8+
# exists
9+
10+
Check if a document exists.
11+
12+
<br/>
13+
14+
```js
15+
exists (index, collection, id, [options]);
16+
```
17+
18+
| Argument | Type | Description |
19+
| ------------ | ----------------- | --------------- |
20+
| `index` | <pre>string</pre> | Index name |
21+
| `collection` | <pre>string</pre> | Collection name |
22+
| `id` | <pre>string</pre> | Document ID |
23+
| `options` | <pre>object</pre> | Query options |
24+
25+
### Options
26+
27+
Additional query options
28+
29+
| Options | Type<br/>(default) | Description |
30+
| ---------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
31+
| `queuable` | <pre>boolean</pre><br/>(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |
32+
| `refresh` | <pre>string</pre><br/>(`""`) | If set to `wait_for`, waits for the change to be reflected for `search` (up to 1s) |
33+
| `silent` | <pre>boolean</pre><br/>(`false`) | If `true`, then Kuzzle will not generate notifications <SinceBadge version="7.5.3"/> |
34+
| [`timeout`](/sdk/7/core-classes/kuzzle/query#timeout) | <pre>number</pre><br/>(`-1`) | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |
35+
36+
## Resolves
37+
38+
Resolves a boolean.
39+
40+
## Usage
41+
42+
<<< ./snippets/exists.js
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
try {
2+
const response = await kuzzle.document.exists('nyc-open-data', 'yellow-taxi', 'some-id');
3+
4+
console.log(response);
5+
} catch (error) {
6+
console.error(error.message);
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: document#exists
2+
description: Check if a document exists in kuzzle
3+
hooks:
4+
before: |
5+
curl -XDELETE kuzzle:7512/nyc-open-data
6+
curl -XPOST kuzzle:7512/nyc-open-data/_create
7+
curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi
8+
curl --fail -H "Content-type: application/json" -XPUT -d '{}' kuzzle:7512/nyc-open-data/yellow-taxi/some-id
9+
after:
10+
template: default
11+
expected: true

0 commit comments

Comments
 (0)