isUuid - Detect if a given keypath contains a valid UUID
isUuid
is a function that detects if a given field is a valid UUID. This is incredibly useful for cleaning data, and also for flagging when information may have become malformed.
isUuid
returns true
if the keypath contains a valid UUID, otherwise false
.
Syntax
Arguments
Name | Type | Required | Description |
---|---|---|---|
uuid | string | true | The candidate UUID value |
Example - Flagging invalid / corrupted UUID values
Consider the following document:
We can see that the first UUID is valid, but the second has been cut off and is no longer valid. We may have millions of these documents, so we don't want to manually check them all. Instead, we can use isUuid
to flag them:
Now, each document will have a flag, is_uuid
which is true
is the field uuid
contains a valid UUID, otherwise it's false, making flagging corrupted values much easier.
Theme
Light