Mongo.uuid

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

Specs

uuid() :: BSON.Binary.t()

Creates a new UUID.

Specs

uuid(any()) :: {:ok, BSON.Binary.t()} | {:error, Exception.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)"}}