|
22 | 22 | </div>
|
23 | 23 |
|
24 | 24 | <div class="form-row">
|
25 |
| - <label for="node-config-input-user"><i class="fa fa-user"></i> Username</label> |
26 |
| - <input type="text" id="node-config-input-user"> |
| 25 | + <label for="node-config-input-username"><i class="fa fa-user"></i> Username</label> |
| 26 | + <input type="text" id="node-config-input-username"> |
27 | 27 | </div>
|
28 | 28 |
|
29 | 29 | <div class="form-row">
|
|
52 | 52 | },
|
53 | 53 | oneditprepare: function() {
|
54 | 54 | $.getJSON("cloudant/"+this.id, function(data) {
|
55 |
| - if (data.user) { |
56 |
| - $("#node-config-input-user").val(data.user); |
| 55 | + if (data.username) { |
| 56 | + $("#node-config-input-username").val(data.username); |
57 | 57 | }
|
58 | 58 | if (data.hasPassword) {
|
59 | 59 | $("#node-config-input-pass").val("__PWRD__");
|
|
63 | 63 | });
|
64 | 64 | },
|
65 | 65 | oneditsave: function() {
|
66 |
| - var newUser = $("#node-config-input-user").val(); |
| 66 | + var newUser = $("#node-config-input-username").val(); |
67 | 67 | var newPass = $("#node-config-input-pass").val();
|
68 | 68 | var credentials = {};
|
69 |
| - credentials.user = newUser; |
| 69 | + credentials.username = newUser; |
70 | 70 | if (newPass != "__PWRD__") {
|
71 | 71 | credentials.password = newPass;
|
72 | 72 | }
|
|
161 | 161 | <select id="node-input-search">
|
162 | 162 | <option value="_id_">_id</option>
|
163 | 163 | <option value="_idx_">search index</option>
|
| 164 | + <option value="_all_">all documents</option> |
164 | 165 | </select>
|
165 | 166 | </div>
|
166 | 167 |
|
|
318 | 319 | A node for searching documents in a Cloudant database.
|
319 | 320 | </p>
|
320 | 321 | <p>
|
321 |
| - Searching for a document can be done in two modes: directly by using the |
322 |
| - document's <b>_id</b> or by using an existing <a |
| 322 | + Searching for documents can be done in three modes: directly by using the |
| 323 | + document's <b>_id</b>, by using an existing <a |
323 | 324 | href="https://cloudant.com/for-developers/search/" target="_blank">Search
|
324 |
| - Index</a>. |
| 325 | + Index</a> or retrieving <b>all documents</b> stored in your database. |
325 | 326 | </p>
|
326 | 327 | <p>
|
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. |
| 328 | + When querying using the <b>_id</b> option, the value for the document's |
| 329 | + <code>_id</code> should be passed in the <code>msg.payload</code> as a |
| 330 | + string. |
329 | 331 | </p>
|
330 | 332 | <p>
|
331 |
| - To use an existing <b>Search Index</b> stored on the desired database, the |
332 |
| - query argument should be passed on the <code>msg.payload</code> following |
333 |
| - the <code>indexName:value</code> pattern. <i>The index must be created |
334 |
| - beforehand on the database.</i> |
| 333 | + To use an existing <b>Search Index</b> stored on the desired database, |
| 334 | + the query argument should be passed on the <code>msg.payload</code> as a |
| 335 | + string following the <code>indexName:value</code> pattern. Keep in mind |
| 336 | + that <i>the index must be created beforehand in the database.</i> and |
| 337 | + referenced here by its <code>design document/index name</code>. |
| 338 | + </p> |
| 339 | + <p> |
| 340 | + When querying using a <b>Search Index</b> you can pass the search |
| 341 | + parameters as an object in <code>msg.payload</code>. For example, you |
| 342 | + can pass an object like this: <code>{ query: "abc*", limit: 100 }</code> |
| 343 | + to change the value of <code>limit</code>. You can find more information |
| 344 | + on the accepted parameters in the <a |
| 345 | + href="https://docs.cloudant.com/api.html?http#queries" target="_blank"> |
| 346 | + official Cloudant documentation</a>. |
| 347 | + </p> |
| 348 | + <p> |
| 349 | + The last method to retrieve documents is to simply get all of them by |
| 350 | + selecting the option <b>all documents</b>. |
335 | 351 | </p>
|
336 | 352 | </script>
|
0 commit comments