UUID v7 cannot be queried in MongoDB via Retool (UUID v4 works)

My goal:

Query documents in MongoDB by _id when _id is stored as a UUID v7 (BinData subtype 04) using Retool.

Issue:

When querying MongoDB through Retool using a UUID v7 value, the query fails with a UUID parsing error.
The same approach works correctly for UUID v4 values.

  • UUID v4 works:
{ "_id": { "$uuid": "77746c49-51e7-4c9e-8791-d2b58f8976a4" } }
  • UUID v7 fails:
{ "_id": { "$uuid": "019b27d0-7651-74be-acdf-e67656120a3a" } }

Using the UUID as a plain string also does not return any documents:

{ "_id": "019b27d0-7651-74be-acdf-e67656120a3a" }

However, MongoDB Compass shows the document correctly as:

_id: UUID("019b27d0-7651-74be-acdf-e67656120a3a")

Retool version & hosting setup:

  • Deployment: Self-hosted Retool
  • Database: MongoDB
  • _id storage type: UUID (Binary subtype 04)
  • UUID version: v7

Error message(s) or screenshots:

Error returned by Retool Mongo query:

Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string

UUID validation check inside Retool:

uuid.validate("019b27d0-7651-74be-acdf-e67656120a3a") // returns false

UUID length and hex format are correct:

  • length: 36
  • hex-only characters: true

What I’ve tried so far:

  • Querying with $uuid (works for UUID v4, fails for UUID v7)
  • Querying with _id as a plain string
  • Verifying the UUID format and length
  • Confirming the document exists and is queryable via MongoDB Compass

Question:

Is querying MongoDB documents by UUID v7 (BinData subtype 04) supported in Retool?
If not, is there an official workaround or recommended approach (e.g. using $binary, automatic conversion, or avoiding UUID v7 for _id)?

Any guidance would be appreciated β€” thanks!

Hi @eevdokimov,

Thanks for reaching out! We have an engineering request to upgrade the uuid library in Retool to access new functions like uuid v7. This is on our roadmap, but I don’t have an eta yet.

I will follow up here when our team updates the uuid library

1 Like