Mongo.uuid

You're seeing just the function uuid, go back to Mongo module for more information.

Creates a new UUID.

Specs

uuid(String.t()) ::
  {:ok, BSON.Binary.t()}
  | {:error, %ArgumentError{__exception__: term(), message: term()}}
uuid(String.t()) :: BSON.Binary.t()

Converts the binary to UUID

Example

iex> Mongo.uuid("848e90e9-5750-4e0a-ab73-66ac6b328242")
{:ok, #BSON.UUID<848e90e9-5750-4e0a-ab73-66ac6b328242>}

iex> Mongo.uuid("848e90e9-5750-4e0a-ab73-66ac6b328242x")
{:error, %ArgumentError{message: "invalid UUID string"}}

iex> Mongo.uuid("848e90e9-5750-4e0a-ab73-66-c6b328242")
{:error, %ArgumentError{message: "non-alphabet digit found: "-" (byte 45)"}}