Skip to content

randomUuid - Generate a random UUID

Generate a random UUIDv4 to function as an identifier for a given document.

Syntax

Like many functions in DataPrime, randomUuid supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.

randomUuid(): string

Example - Adding an ID to a document

Consider the following document:

{
    "path": "/home",
    "domain": "coralogix.com",
    "full_url_encoded": "aHR0cHM6Ly9jb3JhbG9naXguY29tL2hvbWU=" 
}

We do not have any kind of request_id available, but we can use randomUuid() to generate one for us.

create request_id from randomUuid()

After running this function, the document is now:

{
    "path": "/home",
    "domain": "coralogix.com",
    "full_url_encoded": "aHR0cHM6Ly9jb3JhbG9naXguY29tL2hvbWU=",
    "request_id": "37367559-35f4-459c-943e-19025765da15"
}