|
292 | 292 | A simple Cloudant output node. Stores <b>msg</b> in a chosen database.
|
293 | 293 | </p>
|
294 | 294 | <p>
|
295 |
| - Cloudant generates a random id for the <b>msg._id</b> property if one |
| 295 | + Cloudant generates a random id for the <code>_id</code> property if one |
296 | 296 | is not specified and a new document will be <b>inserted</b> each time.
|
297 |
| - If you want to <b>update</b> an existing document you must specify a |
298 |
| - value for <b>msg._id</b> in your object. |
299 |
| - </p> |
300 |
| - <p> |
301 |
| - You can <b>insert</b> only the <b>payload</b> by checking the checkbox |
302 |
| - in the configuration window. |
| 297 | + You can <b>insert</b> only the <code>msg.payload</code> by checking the |
| 298 | + checkbox in the configuration window. |
| 299 | + </p> |
| 300 | + <p> |
| 301 | + If you want to <b>update</b> an existing document you must specify the |
| 302 | + latest values for <code>_id</code> and <code>_rev</code> in your object. |
| 303 | + If they don't match the current values stored in the database you will |
| 304 | + receive a <b>conflict error</b> message, so make sure you are using the |
| 305 | + most updated information for the document. |
303 | 306 | </p>
|
304 | 307 | <p>
|
305 | 308 | It is also possible to <b>delete</b> documents from the database by
|
306 |
| - providing values for <b>msg.payload._id</b> and <b>msg.payload._rev</b> |
307 |
| - and selecting the <b>remove</b> option for the node. |
| 309 | + providing values for <code>_id</b> and <code>_rev</code> and selecting |
| 310 | + the <b>remove</b> option for the node. You can pass these values in the |
| 311 | + <code>msg</code> object itself or as an object in the |
| 312 | + <code>msg.payload</code>. |
308 | 313 | </p>
|
309 | 314 | </script>
|
310 | 315 |
|
|
314 | 319 | </p>
|
315 | 320 | <p>
|
316 | 321 | Searching for a document can be done in two modes: directly by using the
|
317 |
| - document <b>_id</b> or by using an existing <a |
| 322 | + document's <b>_id</b> or by using an existing <a |
318 | 323 | href="https://cloudant.com/for-developers/search/" target="_blank">Search
|
319 | 324 | Index</a>.
|
320 | 325 | </p>
|
321 | 326 | <p>
|
322 |
| - When querying using the <b>_id</b> option, the <code>_id</code> should be |
323 |
| - passed in the <code>msg.payload</code> as a string. |
| 327 | + When querying using the <b>_id</b> option, the value for <code>_id</code> |
| 328 | + should be passed in the <code>msg.payload</code> as a string. |
324 | 329 | </p>
|
325 | 330 | <p>
|
326 | 331 | To use an existing <b>Search Index</b> stored on the desired database, the
|
327 | 332 | query argument should be passed on the <code>msg.payload</code> following
|
328 |
| - the <code>indexName:value</code> pattern. The index must be created beforehand |
329 |
| - on the database. |
| 333 | + the <code>indexName:value</code> pattern. <i>The index must be created |
| 334 | + beforehand on the database.</i> |
330 | 335 | </p>
|
331 | 336 | </script>
|
0 commit comments