The Fauna service will be ending on May 30, 2025.

For more information on the service wind down, see our announcement and the Fauna Service End-of-Life FAQ.

newId()

Get a unique string-encoded 64-bit integer.

Signature

newId() => ID

Description

The newId() method returns a number that is guaranteed to be unique across all databases and is suitable for constructing the document ID part of a document reference.

Document IDs are generated using the Twitter Snowflake algorithm. The IDs are based on time instead of sequential numbers and are generally increasing. The newId() method shouldn’t be used to generate random numbers.

Parameters

None

Return value

Type Description

ID

Numeric value that is unique across databases.

Examples

newId()
"374494810266927169"
\