Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valid characters for Firestore document ID [duplicate]

I can't seem to find the following information in the Firestore docs:

  1. What characters are valid to use in a document ID?
  2. What characterset is used to generate a Firestore AutoID?
like image 905
twiz Avatar asked May 17 '19 16:05

twiz


People also ask

Can two documents have the same ID in firestore?

You cannot have several documents with the same ID in one Collection: a document ID must be unique across a collection.

How many bytes long the document ID is?

Document ID size The size of a document ID is either the string size for a string ID or 8 bytes for an integer ID.

How long is a firestore ID?

The documentation says that the limit for all document IDs is 1500 bytes.

Are firebase document IDs unique?

The names of documents within a collection are unique. You can provide your own keys, such as user IDs, or you can let Cloud Firestore create random IDs for you automatically.


1 Answers

You will find the responses in this documentation item: https://firebase.google.com/docs/firestore/quotas#collections_documents_and_fields

Constraints on document IDs

  • Must be valid UTF-8 characters
  • Must be no longer than 1,500 bytes
  • Cannot contain a forward slash (/)
  • Cannot solely consist of a single period (.) or double periods (..)
  • Cannot match the regular expression __.*__
like image 185
Renaud Tarnec Avatar answered Nov 16 '22 04:11

Renaud Tarnec