You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(items.length!=1) throw'Unable to find metadata document';
338
+
339
+
var metadataItem = items[0];
340
+
341
+
// update metadata
342
+
metadataItem.createdItems+=1;
343
+
metadataItem.createdNames+=""+createdItem.id;
344
+
var accept =container.replaceDocument(metadataItem._self,
345
+
metadataItem, function(err, itemReplaced) {
346
+
if(err) throw"Unable to update metadata, abort";
347
+
});
348
+
if(!accept) throw"Unable to update metadata, abort";
349
+
return;
350
+
}
351
351
}
352
352
```
353
353
@@ -371,17 +371,16 @@ The following is a function definition to calculate income tax for various incom
371
371
372
372
```javascript
373
373
functiontax(income) {
374
-
375
-
if(income ==undefined)
376
-
throw'no input';
377
-
378
-
if (income <1000)
379
-
return income *0.1;
380
-
elseif (income <10000)
381
-
return income *0.2;
382
-
else
383
-
return income *0.4;
384
-
}
374
+
if (income ==undefined)
375
+
throw'no input';
376
+
377
+
if (income <1000)
378
+
return income *0.1;
379
+
elseif (income <10000)
380
+
return income *0.2;
381
+
else
382
+
return income *0.4;
383
+
}
385
384
```
386
385
387
386
For examples of how to register and use a user-defined function, see [How to use user-defined functions in Azure Cosmos DB](how-to-use-stored-procedures-triggers-udfs.md#how-to-work-with-user-defined-functions) article.
0 commit comments