@openfn/language-mongodb 2.1.6 → 2.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/ast.json +13 -2
  2. package/package.json +2 -2
package/ast.json CHANGED
@@ -407,7 +407,7 @@
407
407
  "operation"
408
408
  ],
409
409
  "docs": {
410
- "description": "Scopes an array of data based on a JSONPath.\nUseful when the source data has `n` items you would like to map to\nan operation.\nThe operation will receive a slice of the data based of each item\nof the JSONPath provided.\n\nIt also ensures the results of an operation make their way back into\nthe state's references.",
410
+ "description": "Iterates over an array of items and invokes an operation upon each one, where the state\nobject is _scoped_ so that state.data is the item under iteration.\nThe rest of the state object is untouched and can be referenced as usual.\nYou can pass an array directly, or use lazy state or a JSONPath string to\nreference a slice of state.",
411
411
  "tags": [
412
412
  {
413
413
  "title": "public",
@@ -421,7 +421,18 @@
421
421
  },
422
422
  {
423
423
  "title": "example",
424
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
424
+ "description": "each(\n $.data,\n // Inside the callback operation, `$.data` is scoped to the item under iteration\n insert(\"patient\", {\n patient_name: $.data.properties.case_name,\n patient_id: $.data.case_id,\n })\n);",
425
+ "caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
426
+ },
427
+ {
428
+ "title": "example",
429
+ "description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
430
+ "caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
431
+ },
432
+ {
433
+ "title": "example",
434
+ "description": "each(\n \"$.data[*]\",\n insert(\"patient\", (state) => ({\n patient_name: state.data.properties.case_name,\n patient_id: state.data.case_id,\n }))\n);",
435
+ "caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
425
436
  },
426
437
  {
427
438
  "title": "param",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-mongodb",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "description": "A language package for working with MongoDb",
5
5
  "main": "dist/index.cjs",
6
6
  "author": "Open Function Group",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "dependencies": {
15
15
  "mongodb": "^3.7.3",
16
- "@openfn/language-common": "2.1.0"
16
+ "@openfn/language-common": "2.1.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@openfn/simple-ast": "0.4.1",