From 5768e1e48e7d4d57cb405695cd642a1571a6e661 Mon Sep 17 00:00:00 2001 From: Ray Offiah Date: Mon, 17 Feb 2025 10:34:16 +0000 Subject: [PATCH 1/2] [DOC-11870]: Feedback on Data Enrichment docs Changed rogue occurrence of `without` to `with`. Grammar and punctuation fixes. Signed-off-by: Ray Offiah --- .../eventing-example-data-enrichment.adoc | 248 ++++++++++-------- 1 file changed, 140 insertions(+), 108 deletions(-) diff --git a/modules/eventing/pages/eventing-example-data-enrichment.adoc b/modules/eventing/pages/eventing-example-data-enrichment.adoc index abc4e28fc..72b8e20fd 100644 --- a/modules/eventing/pages/eventing-example-data-enrichment.adoc +++ b/modules/eventing/pages/eventing-example-data-enrichment.adoc @@ -1,48 +1,66 @@ = Data Enrichment -:description: pass:q[Given a legacy document set containing attributes whose format makes them difficult to search on. In order to correct this search deficiency new searchable attributes will be added to the document.] +:description: Given a legacy document set containing attributes whose format makes them difficult to search on. In order to correct this search deficiency, new searchable attributes will be added to the document. :page-edition: Enterprise Edition -*Goal*: {description} These new attributes related to and can be calculated from the original attributes. On any mutation (a document creation or modification) the new attributes should also be created (or updated) +*Goal*: {description} These new attributes related to and can be calculated from the original attributes. On any mutation (a document creation or modification), the new attributes should also be created (or updated) -*Implementation*: Implementation: Create JavaScript function that contains an *OnUpdate* handler. The handler listens for mutations or data-changes within a specified "Listen To Location" (or source collection). When any document within the collection is created or modified, the Eventing Function executes a user-defined routine. In this example, if the created or altered document contains two specifically named fields containing IP addresses (these respectively corresponding to the beginning and end of an address-range), the Eventing Function routine, _get_numip_first_3_octets(ip)_, converts each of the IP addresses to an integer and upserts them as new fields in the document. +*Implementation*: Implementation: Create a JavaScript function that contains an `OnUpdate` handler. +The handler listens for mutations or data-changes within a specified "Listen To Location" (or source collection). +When any document within the collection is created or modified, the Eventing Function executes a user-defined routine. +In this example, +if a new or updated document has two specifically named fields with IP addresses +(representing the start and end of an address range), +the Eventing Function uses `_get_numip_first_3_octets(ip)` +to convert those IPs into integers and adds them as new fields in the document. ** *Case 1*: A new document is created in a specified, target collection: this new document is identical to the old, except that it has two new additional fields, which contain integers that correspond to the IP addresses. The original document, in the source collection, is not changed. -** *Case 2*: The original document, in the source collection, is mutated (or changed) to have two additional fields, which contain integers that correspond to the IP addresses. In this case the Eventing Service automatically suppresses the recursive mutation.  +** *Case 2*: The original document, in the source collection, is mutated (or changed) to have two additional fields, which contain integers that correspond to the IP addresses. In this case the Eventing Service automatically suppresses the recursive mutation. *Preparations (Common):* -For this example, two (2) buckets *'bulk'* and *'rr100'* are required where the latter is intended to be 100% resident. +For this example, two (2) buckets `bulk` and `rr100` are required where the latter is intended to be 100% resident. Create the buckets with a minimum size of 100MB. For information on buckets, see xref:manage:manage-buckets/create-bucket.adoc[Create a Bucket]. -Within the buckets we need three (3) keyspaces *'bulk.data.source'*, *'bulk.data.target'*, and *'rr100.eventing.metadata'* +Within the buckets we need three (3) keyspaces `bulk.data.source`, `bulk.data.target`, and `rr100.eventing.metadata` (we loosely follow this xref:eventing-buckets-to-collections.adoc#single-tenancy[organization]). -For the Function Scope or RBAC grouping, we will use the *'bulk.data'*, assuming you have the role of either "Full Admin" or "Eventing Full Admin". -For standard or non-privileged users refer to xref:eventing-rbac.adoc[Eventing Role-Based Access Control]. - -_If you run a version of Couchbase prior to 7.0 you can just create the buckets *'source'*, *'target'*, and *'metadata'* and run this example. Furthermore if your cluster was subsequently upgraded from say 6.6.2 to 7.0 your data would be moved to *'source._default._default'*, *'target._default._default'*, and *'metadata._default._default'* and your Eventing Function would be seamlessly upgraded to use the new keyspaces and continue to run correctly._ +For the Function Scope or RBAC grouping, we will use the `bulk.data`, +assuming you have the role of either "Full Admin" or "Eventing Full Admin". +For standard or non-privileged users, refer to xref:eventing-rbac.adoc[Eventing Role-Based Access Control]. + +[NOTE] +==== +If you run a version of Couchbase prior to 7.0, you can create the buckets `source`, +`target`, and `metadata` and run this example. +Furthermore, if your cluster was subsequently upgraded from, say, +6.6.2 to 7.0, your data would be moved to `source._default._default`, +`target._default._default`, +and `metadata._default._default` and your Eventing Function would be seamlessly upgraded +to use the new keyspaces and continue to run correctly. +==== // TODO7X - need to check/fix this (buckets, scopes, collections) -For complete details on how to set up your keyspaces refer to xref:manage:manage-buckets/create-bucket.adoc[creating buckets] and +For complete details on how to set up your keyspaces, +refer to xref:manage:manage-buckets/create-bucket.adoc[creating buckets] and xref:manage:manage-scopes-and-collections/manage-scopes-and-collections.adoc[creating scopes and collections]. -NOTE: The Eventing Storage keyspace, in this case *'rr100.eventing.metadata'*, is for the sole use of the Eventing system, do not add, modify, or delete documents from it. In addition do not drop or flush or delete the containing bucket (or delete this collection) while you have any deployed Eventing functions. In a single tenancy deployment this collection can be shared with other Eventing functions. +NOTE: The Eventing Storage keyspace, in this case `rr100.eventing.metadata`, is for the sole use of the Eventing system, do not add, modify, or delete documents from it. In addition, do not drop or flush or delete the containing bucket (or delete this collection) while you have any deployed Eventing functions. In a single tenancy deployment this collection can be shared with other Eventing functions. *Procedure (Case 1)*: -. Access the *Couchbase Web Console* > *Buckets* page and click the *Scopes and Collections* link of the *bulk* bucket. -** Click *Documents* in the upper right banner for the *data* scope. -** Select the keyspace *bulk*, *data*, *source* +. Access the menu:Couchbase Web Console[Buckets] page and click the btn:[Scopes and Collections] link of the [.ui]*bulk* bucket. +** Click btn:[Documents] in the upper right banner for the [.ui]*data* scope. +** Select the keyspace [.ui]*bulk*, [.ui]*data*, [.ui]*source* ** You should see no user records. -** Click *Add Document* in the upper right banner -** For the *ID* in the *Create New Document* dialog specify *SampleDocument* +** Click btn:[Add Document] in the upper right banner +** For the *ID* in the *Create New Document* dialog, specify *SampleDocument* + ---- ID [ SampleDocument ] ---- + -** For the document body in the *Create New Document* dialog, the following text is displayed: +** For the document body in the [.ui]*Create New Document* dialog, the following text is displayed: + ---- { @@ -59,34 +77,35 @@ ID [ SampleDocument ] "ip_end": "5.62.60.9" } ---- -** Click *Save*. - -. From the *Couchbase Web Console* > *Eventing* page, click *ADD FUNCTION*, to add a new Function. -The *ADD FUNCTION* dialog appears. -. In the *ADD FUNCTION* dialog, for individual Function elements provide the below information: - ** For the *Function Scope* drop-down, select *'bulk.data'* as the RBAC grouping. - ** For the *Listen To Location* drop-down, select *bulk*, *data*, *source* as the keyspace. - ** For the *Eventing Storage* drop-down, select *rr100*, *eventing*, *metadata* as the keyspace. - ** Enter *case_1_enrich_ips* as the name of the Function you are creating in the *Function Name* text-box. +** Click btn:[Save]. + +. From the menu:Couchbase Web Console[Eventing] page, click btn:[ADD FUNCTION] to add a new Function. +The [.ui]*ADD FUNCTION* dialog appears. +. In the [.ui]*ADD FUNCTION* dialog, for individual Function elements provide the below information: + ** For the menu:Function Scope[] drop-down, select `bulk.data` as the RBAC grouping. + ** For the menu:Listen To Location[] drop-down, select `bulk`, `data`, `source` as the keyspace. + ** For the menu:Eventing Storage[] drop-down, select `rr100`, `eventing`, `metadata` as the keyspace. + ** Enter `case_1_enrich_ips` as the name of the Function you are creating in the [.ui]*Function Name* text-box. ** Leave the "Deployment Feed Boundary" as Everything. - ** [Optional Step] Enter text *On mutation create a new document in a different collection with additional fields*, in the *Description* text-box. - ** For the *Settings* option, use the default values. - ** For the *Bindings* option, add two bindings. - *** For the first binding, select "bucket alias", specify *src* as the "alias name" of the collection, - select *bulk*, *data*, *source* as the associated keyspace, and select "read only" for the access mode. - *** For the second binding, select "bucket alias", specify *tgt* as the "alias name" of the collection, - select *bulk*, *data*, and *target* as the associated keyspace, and select "read and write" for the access mode. - ** After configuring your settings the *ADD FUNCTION* dialog should look like this: + ** [Optional Step] Enter the text: `On mutation create a new document in a different collection with additional fields`, in the [.ui]*Description* text-box. + ** For the [.ui]*Settings* option, use the default values. + ** For the [.ui]*Bindings* option, add two bindings. + *** For the first binding, select `bucket alias`, specify [.ui]*src* as the `alias name` of the collection; + select [.ui]*bulk*, [.ui]*data*, [.ui]*source* as the associated keyspace, and select `read only` for the access mode. + *** For the second binding, select `bucket alias`, specify [.ui]*tgt* as the `alias name` of the collection, + select [.ui]*bulk*, [.ui]*data*, and [.ui]*target* as the associated keyspace, + and select `read and write` for the access mode. + ** After configuring your settings, the [.ui]*ADD FUNCTION* dialog should look like this: + image::enrichcase1_01_settings.png[,484] -. After providing all the required information in the *ADD FUNCTION* dialog, click *Next: Add Code*. +. After providing all the required information in the [.ui]*ADD FUNCTION* dialog, click *Next: Add Code*. The *case_1_enrich_ips* dialog appears. ** The *case_1_enrich_ips* dialog initially contains a placeholder code block. -You will substitute your actual *case_1_enrich_ips code* in this block. +You will substitute your actual `case_1_enrich_ips` code in this block. + image::enrichcase1_02_editor_with_default.png[,100%] -** Copy the following Function, and paste it in the placeholder code block of *case_1_enrich_ips* dialog. +** Copy the following function and paste it in the placeholder code block of the[.ui]*case_1_enrich_ips* dialog. + [source,javascript] ---- @@ -110,23 +129,31 @@ function get_numip_first_3_octets(ip) { After pasting, the screen appears as displayed below: + image::enrichcase1_03_editor_with_code.png[,100%] -** Click *Save and Return*. +** Click btn:[Save and Return]. -. The *OnUpdate* routine specifies that when a change occurs to data within the bucket, the routine *get_numip_first_3_octets* is run on each document that contains *ip_start* and *ip_end*. A new document is created whose data and metadata are based on those of the document on which *get_numip_first_3_octets* is run; but with the addition of *ip_num_start* and *ip_num_end data-fields*, which contain the numeric values returned by *get_numip_first_3_octets*. The *get_numip_first_3_octets* routine splits the IP address, converts each fragment to a numeral, and adds the numerals together, to form a single value; which it returns. +. The `OnUpdate` routine specifies that when a change occurs to data within the bucket, +the routine `get_numip_first_3_octets` is run on each document that contains `ip_start` and `ip_end`. +A new document is created whose data and metadata are based on those of the document on which `get_numip_first_3_octets` is run; +but with the addition of `ip_num_start` and `ip_num_end` data-fields, +which contain the numeric values returned by `get_numip_first_3_octets`. +The `get_numip_first_3_octets` routine splits the IP address, converts each fragment to a numeral, +and adds the numerals together to form a single value, which it returns. -. From the *Eventing* screen, click the *case_1_enrich_ips* function to select it, then click *Deploy*. +. From the [.ui]*Eventing* screen, click the `case_1_enrich_ips` function to select it, then click btn:[Deploy]. + image::enrichcase1_03a_deploy.png[,100%] + -** In the *Confirm Deploy Function* Click *Deploy Function*. +** In the [.ui]*Confirm Deploy Function*, click btn:[Deploy Function]. -. The Eventing function is deployed and starts running within a few seconds. From this point, the defined Function is executed on all existing documents and will also more importantly it will also run on subsequent mutations. +. The Eventing function is deployed and starts running within a few seconds. +From this point, the defined Function is executed on all existing documents +and will also, more importantly, run on subsequent mutations. . To check the results of the deployed Eventing Function: -** Access the *Couchbase Web Console* > *Buckets* page and click the *Scopes and Collections* link of the *bulk* bucket. -** Click *Documents* in the upper right banner for the *data* scope. -** Select the keyspace *bulk*, *data*, *target* -** Edit the document and you will see a duplicate of the source bucket but without two new calculated fields as follows: +** Access the menu:Couchbase Web Console[Buckets] page and click the btn:[Scopes and Collections] link of the [.ui]*bulk* bucket. +** Click btn[Documents] in the upper right banner for the [.ui]*data* scope. +** Select the keyspace [.ui]*bulk*, [.ui]*data*, [.ui]*target* +** Edit the document, and you will see a duplicate of the source bucket but with two new calculated fields as follows: + ---- { @@ -137,21 +164,21 @@ image::enrichcase1_03a_deploy.png[,100%] "ip_num_end": 87964681 } ---- -** Click *Cancel* to close the editor. +** Click btn:[Cancel] to close the editor. -. Because our Eventing Function is deployed it will continue to process all new mutations, let's test this out. -** Access the *Couchbase Web Console* > *Buckets* page and click the *Scopes and Collections* link of the *bulk* bucket. -** Click *Documents* in the upper right banner for the *data* scope. -** Select the keyspace *bulk*, *data*, *source* +. Because our Eventing Function is deployed, it will continue to process all new mutations, let's test this out. +** Access the menu:Couchbase Web Console[Buckets] page and click the btn:[Scopes and Collections] link of the [.ui]*bulk* bucket. +** Click btn:[Documents] in the upper right banner for the [.ui]*data* scope. +** Select the keyspace [.ui]*bulk*,[.ui]*data*, [.ui]*source* ** You should see one user record (the one we entered at the beginning of this procedure). -** Click *Add Document* in the upper right banner -** For the *ID* in the *Create New Document* dialog specify *AnotherSampleDocument* +** Click btn:[Add Document] in the upper right banner +** For the [.ui]*ID* in the [.ui]*Create New Document* dialog, specify `AnotherSampleDocument` + ---- ID [ AnotherSampleDocument ] ---- + -** For the document body in the *Create New Document* dialog, the following text is displayed: +** For the document body in the [.ui]*Create New Document* dialog, the following text is displayed: + ---- { @@ -168,13 +195,13 @@ ID [ AnotherSampleDocument ] "ip_end": "7.62.60.9" } ---- -** Click *Save*. +** Click btn:[Save]. . To check results (*which were updated in real time*) by the deployed Eventing Function: -** Access the *Couchbase Web Console* > *Buckets* page and click the *Scopes and Collections* link of the *bulk* bucket. -** Click *Documents* in the upper right banner for the *data* scope. -** Select the keyspace *bulk*, *data*, *target* -** Edit the newly created document and you will see a duplicate of the source bucket but without two new calculated fields as follows: +** Access the menu:Couchbase Web Console[Buckets] page and click the *Scopes and Collections* link of the [.ui]*bulk* bucket. +** Click btn:[Documents] in the upper right banner for the [.ui]*data* scope. +** Select the keyspace [.ui]*bulk*, [.ui]*data*, [.ui]*target* +** Edit the newly created document, and you will see a duplicate of the source bucket but with two new calculated fields as follows: + ---- { @@ -185,22 +212,25 @@ ID [ AnotherSampleDocument ] "ip_num_end": 121519113 } ---- -** Click *Cancel* to close the editor. +** Click btn:[Cancel] to close the editor. *Procedure (Case 2)*: -. *IMPORTANT* undeploy the Eventing Function (if running) *case_1_enrich_ips*. Access the *Couchbase Web Console* > *Eventing* page and click the function name *case_1_enrich_ips* link of the *source* bucket. +IMPORTANT: Undeploy the Eventing Function `case_1_enrich_ips`, if it's running. + +. Access the menu:Couchbase Web Console[Eventing] page and click the function name [.ui]*case_1_enrich_ips* link of the *source* bucket. + image::enrichcase1_03b_undeploy.png[,100%] + -** Click *Undeploy* -** Click *Undeploy Function* to confirm. - -. We assume that the two documents from *Case 1* above exist in the 'source' collection. If they don't please create them in the 'source' collection. -** Access the *Couchbase Web Console* > *Buckets* page and click the *Scopes and Collections* link of the *bulk* bucket. -** Click *Documents* in the upper right banner for the *data* scope. -** Select the keyspace *bulk*, *data*, *source* +** Click btn:[Undeploy] +** Click btn:[Undeploy Function] to confirm. + +. We assume that the two documents from *Case 1* above exist in the `source` collection. +If they don't, please create them in the `source` collection. +** Access the menu:Couchbase Web Console[Buckets] page and click the btn:[Scopes and Collections] link of the [.ui]*bulk* bucket. +** Click btn:[Documents] in the upper right banner for the [.ui]*data* scope. +** Select the keyspace [.ui]*bulk*, [.ui]*data*, [.ui]*source* ** You should see two user records (as previously created above). + ---- @@ -216,30 +246,30 @@ image::enrichcase1_03b_undeploy.png[,100%] } ---- -. From the *Couchbase Web Console* > *Eventing* page, click *ADD FUNCTION*, to add a new Function. -The *ADD FUNCTION* dialog appears. -. In the *ADD FUNCTION* dialog, for individual Function elements provide the below information: - ** For the *Function Scope* drop-down, select *'bulk.data'* as the RBAC grouping. - ** For the *Listen To Location* drop-down, select *bulk*, *data*, *source* as the keyspace. - ** For the *Eventing Storage* drop-down, select *rr100*, *eventing*, *metadata* as the keyspace. - ** Enter *case_2_enrich_ips* as the name of the Function you are creating in the *Function Name* text-box. - ** Leave the "Deployment Feed Boundary" as Everything. - ** [Optional Step] Enter text *On mutation create a new document in the same collection with additional fields*, in the *Description* text-box. - ** For the *Settings* option, use the default values. - ** For the *Bindings* option, add two bindings. - *** For the only binding, select "bucket alias", specify *src* as the "alias name" of the collection, - select *bulk*, *data*, *source* as the associated keyspace, and select "read and write" for the access mode. - ** After configuring your settings the *ADD FUNCTION* dialog should look like this: +. From the menu:Couchbase Web Console[Eventing] page, click btn:[ADD FUNCTION], to add a new Function. +The [.ui]*ADD FUNCTION* dialog appears. +. In the [.ui]*ADD FUNCTION* dialog, for individual Function elements provide the below information: + ** For the menu:Function Scope[] drop-down, select [.ui]*bulk.data* as the RBAC grouping. + ** For the menu:Listen To Location[] drop-down, select [.ui]*bulk*, [.ui]*data*, [.ui]*source* as the keyspace. + ** For the menu:Eventing Storage[] drop-down, select [.ui]*rr100*, [.ui]*eventing*, [.ui]*metadata* as the keyspace. + ** Enter `case_2_enrich_ips` as the name of the Function you are creating in the [.ui]*Function Name* text-box. + ** Leave the [.ui]*Deployment Feed Boundary* as `Everything`. + ** [Optional Step] Enter the text: `On mutation create a new document in the same collection with additional fields` in the *Description* text-box. + ** For the [.ui]*Settings* option, use the default values. + ** For the [.ui]*Bindings* option, add two bindings. + *** For the only binding, `select bucket alias`, specify [.ui]*src* as the `alias name` of the collection, + select [.ui]*bulk*, [.ui]*data*, [.ui]*source* as the associated keyspace, and select `read and write` for the access mode. + ** After configuring your settings, the [.ui]*ADD FUNCTION* dialog should look like this: + image::enrichcase2_01_settings.png[,484] -. After providing all the required information in the *ADD FUNCTION* dialog, click *Next: Add Code*. -The *case_2_enrich_ips* dialog appears. -** The *case_2_enrich_ips* dialog initially contains a placeholder code block. -You will substitute your actual *case_2_enrich_ips code* in this block. +. After providing all the required information in the [.ui]*ADD FUNCTION* dialog, click btn:[Next: Add Code]. +The [.ui]*case_2_enrich_ips* dialog appears. +** The [.ui]*case_2_enrich_ips* dialog initially contains a placeholder code block. +You will substitute your actual `case_2_enrich_ips` code in this block. + image::enrichcase2_02_editor_with_default.png[,100%] -** Copy the following Function, and paste it in the placeholder code block of *case_2_enrich_ips* dialog. +** Copy the following function and paste it in the placeholder code block of the [.ui]*case_2_enrich_ips* dialog. + [source,javascript] ---- @@ -264,23 +294,23 @@ function get_numip_first_3_octets(ip) { After pasting, the screen appears as displayed below: + image::enrichcase2_03_editor_with_code.png[,100%] -** Click *Save and Return*. +** Click btn:[Save and Return]. -. The *OnUpdate* routine specifies that when a change occurs to data within the bucket, the routine *get_numip_first_3_octets* is run on each document that contains *ip_start* and *ip_end*. A new document is created whose data and metadata are based on those of the document on which *get_numip_first_3_octets* is run; but with the addition of *ip_num_start* and *ip_num_end data-fields*, which contain the numeric values returned by *get_numip_first_3_octets*. The *get_numip_first_3_octets* routine splits the IP address, converts each fragment to a numeral, and adds the numerals together, to form a single value; which it returns. +. The `OnUpdate` routine specifies that when a change occurs to data within the bucket, the routine `get_numip_first_3_octets` is run on each document that contains `ip_start` and `ip_end`. A new document is created whose data and metadata are based on those of the document on which `get_numip_first_3_octets` is run; but with the addition of `ip_num_start` and `ip_num_end` data-fields, which contain the numeric values returned by `get_numip_first_3_octets`. The `get_numip_first_3_octets` routine splits the IP address, converts each fragment to a numeral, and adds the numerals together, to form a single value; which it returns. -. From the *Eventing* screen, click the *case_2_enrich_ips* function to select it, then click *Deploy*. +. From the *Eventing* screen, click the `case_2_enrich_ips` function to select it, then click btn:*Deploy]. + image::enrichcase2_03a_deploy.png[,100%] + -** In the *Confirm Deploy Function* Click *Deploy Function*. +** In the [.ui]*Confirm Deploy Function*, click btn:[Deploy Function]. -. The Eventing function is deployed and starts running within a few seconds. From this point, the defined Function is executed on all existing documents and will also more importantly it will also run on subsequent mutations. Unlike our fist example the documents that are the source of the mutations will be updated. +. The Eventing function is deployed and starts running within a few seconds. From this point, the defined Function is executed on all existing documents and will also, more importantly, run on subsequent mutations. Unlike our first example, the documents that are the source of the mutations will be updated. . To check results (*which were updated in real time*) by the deployed Eventing Function: -** Access the *Couchbase Web Console* > *Buckets* page and click the *Scopes and Collections* link of the *bulk* bucket. -** Click *Documents* in the upper right banner for the *data* scope. -** Select the keyspace *bulk*, *data*, *source* -** Edit the "SampleDocument" it will have been enriched or modified with two new calculated fields: +** Access the menu:Couchbase Web Console[Buckets] page and click the btn:[Scopes and Collections] link of the [.ui]*bulk* bucket. +** Click btn:[Documents] in the upper right banner for the [.ui]*data* scope. +** Select the keyspace [.ui]*bulk*, [.ui]*data*, [.ui]*source* +** Edit the `SampleDocument` it will have been enriched or modified with two new calculated fields: + ---- { @@ -291,7 +321,7 @@ image::enrichcase2_03a_deploy.png[,100%] "ip_num_end": 87964681 } ---- -** Edit the "AnotherSampleDocument" it will also have been enriched or modified with two new calculated fields: +** Edit the `AnotherSampleDocument` it will also have been enriched or modified with two new calculated fields: + ---- { @@ -302,14 +332,14 @@ image::enrichcase2_03a_deploy.png[,100%] "ip_num_end": 121519113 } ---- -** Click *Cancel* to close the editor. +** Click btn:[Cancel] to close the editor. -. Because our Eventing Function is deployed it will continue to process all new mutations, let's test this out. +. Because our Eventing Function is deployed, it will continue to process all new mutations, let's test this out. -** Access the *Couchbase Web Console* > *Buckets* page and click the *Scopes and Collections* link of the *bulk* bucket. -** Click *Documents* in the upper right banner for the *data* scope. -** Select the keyspace *bulk*, *data*, *source* -** Edit at "AnotherSampleDocument" again BUT change "ip_start" to "6.12.60.1" +** Access the menu:Couchbase Web Console[Buckets] page and click the btn:[Scopes and Collections] link of the *bulk* bucket. +** Click btn:[Documents] in the upper right banner for the [.ui]*data* scope. +** Select the keyspace [.ui]*bulk*, [.ui]*data*, [.ui]*source* +** Edit at `AnotherSampleDocument` again BUT change `"ip_start"` to `"6.12.60.1"` + ---- { @@ -320,8 +350,8 @@ image::enrichcase2_03a_deploy.png[,100%] "ip_num_end": 121519113 } ---- -** Click *Save* to update the document and close the editor. -** Edit at "AnotherSampleDocument" again and see the recalculation of "ip_num_start": 118242305 to "ip_num_start": 101465089 happened in real-time. +** Click btn:[Save] to update the document and close the editor. +** Edit at `AnotherSampleDocument` again and see the recalculation of `"ip_num_start"`: `118242305` to `"ip_num_start"`: `101465089` happened in real-time. + ---- { @@ -332,10 +362,12 @@ image::enrichcase2_03a_deploy.png[,100%] "ip_num_end": 121519113 } ---- -** Click *Cancel* to close the editor. +** Click btn:[Cancel] to close the editor. *Cleanup (both Case 1 and Case 2)*: -Go to the Eventing portion of the UI and undeploy the Function(s) case_1_enrich_ips and case_2_enrich_ips, this will remove the 1024 documents for each function from the 'rr100.eventing.metadata' collection (in the Bucket view of the UI). Remember you may only delete the 'rr100.eventing.metadata' keyspace if there are no deployed Eventing Functions. +Go to the Eventing portion of the UI and undeploy the Function(s) `case_1_enrich_ips` and `case_2_enrich_ips`, +this will remove the 1024 documents for each function from the `rr100.eventing.metadata` collection (in the Bucket view of the UI). +Remember you may only delete the `rr100.eventing.metadata keyspace` if there are no deployed Eventing Functions. Now flush the 'bulk' bucket if you plan to run other examples (you may need to Edit the bucket 'bulk' and enable the flush capability). From 53334a40df2bae7e8a41856b945cd1228978e47f Mon Sep 17 00:00:00 2001 From: Ray Offiah Date: Tue, 18 Feb 2025 14:35:56 +0000 Subject: [PATCH 2/2] [DOC-11870]: Feedback on Data Enrichment docs Changed rogue occurrence of `without` to `with`. Grammar and punctuation fixes. Signed-off-by: Ray Offiah --- modules/eventing/pages/eventing-example-data-enrichment.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/eventing/pages/eventing-example-data-enrichment.adoc b/modules/eventing/pages/eventing-example-data-enrichment.adoc index 72b8e20fd..c32641d2b 100644 --- a/modules/eventing/pages/eventing-example-data-enrichment.adoc +++ b/modules/eventing/pages/eventing-example-data-enrichment.adoc @@ -10,7 +10,7 @@ When any document within the collection is created or modified, the Eventing Fun In this example, if a new or updated document has two specifically named fields with IP addresses (representing the start and end of an address range), -the Eventing Function uses `_get_numip_first_3_octets(ip)` +the Eventing Function uses `get_numip_first_3_octets(ip)` to convert those IPs into integers and adds them as new fields in the document. ** *Case 1*: A new document is created in a specified, target collection: this new document is identical to the old, except that it has two new additional fields, which contain integers that correspond to the IP addresses. The original document, in the source collection, is not changed.