Supported data types

This page describes the data types that Cloud Firestore supports.

Data types

Data type Sort order Notes
Array By elements and if elements equal, by array length

Cannot contain another array value.

Arrays are sorted by elements. If elements are equal, the arrays are sorted by length.

For example, [1, 2, 3] < [1, 2, 3, 1] < [2].

Boolean false < true
Bytes Byte order Up to 1,048,487 bytes (1 MiB - 89 bytes). Only the first 1,500 bytes are considered by queries.
Date and time Chronological When stored in Cloud Firestore, precise only to microseconds; any additional precision is rounded down.
Floating-point number Numeric 64-bit double precision, IEEE 754.
Geographical point By latitude, then longitude
Integer Numeric 64-bit, signed
Map By keys, then by value

Represents an object embedded within a document. When indexed, you can query on subfields. If you exclude this value from indexing, then all subfields are also excluded from indexing.

Key ordering is always sorted. For example, if you write {c: "foo", a: "bar", b: "qux"} the map is sorted by key and saved as {a: "foo", b: "bar", c: "qux"}.

Map fields are sorted by key and compared by key-value pairs, first comparing the keys and then the values. If the first key-value pairs are equal, the next key-value pairs are compared, and so on. If two maps start with the same key-value pairs, then map length is considered. For example, the following maps are in ascending order:

{a: "aaa", b: "baz"}
{a: "foo", b: "bar"}
{a: "foo", b: "bar", c: "qux"}
{a: "foo", b: "baz"}
{b: "aaa", c: "baz"}
{c: "aaa"}

Null None
Reference By path elements (collection, document ID, collection, document ID...) For example, projects/[PROJECT_ID]/databases/[DATABASE_ID]/documents/[DOCUMENT_PATH].
Text string UTF-8 encoded byte order Up to 1,048,487 bytes (1 MiB - 89 bytes). Only the first 1,500 bytes of the UTF-8 representation are considered by queries.

Value type ordering

When a query involves a field with values of mixed types, Cloud Firestore uses a deterministic ordering based on the internal representations. The following list shows the order:

  1. Null values
  2. Boolean values
  3. Integer and floating-point values, sorted in numerical order
  4. Date values
  5. Text string values
  6. Byte values
  7. Cloud Firestore references
  8. Geographical point values
  9. Array values
  10. Map values

Оставить отзыв о...

Текущей странице
Нужна помощь? Обратитесь в службу поддержки.