FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. For more details, review the migration guide. Contact support@fauna.com with any questions. |
NewId
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
NewId()
new_id()
NewId()
NewId()
NewId()
Description
The NewId
function produces a number which is guaranteed to be
unique across all databases and is suitable for constructing the
document ID part of a Reference.
Fauna’s document IDs are generated using the
Twitter
Snowflake algorithm. The IDs are based on time instead of being
sequential, and are generally increasing. As such, the FQL does not provide random number generation, as its operations attempt to be as deterministic as possible. If you need a source of random numbers, your host language or browser can provide high-performance random number generation. Once you have generated a random number, you can then use it within your queries in deterministic fashion. |
Examples
The following query returns a unique string-encoded 64-bit integer:
181388643266462208
"181388643266462208"
280481920441123328
StringV(280491725429932544)
'302044032378339840'
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!