VectorValue class

Represents a vector type in Firestore documents. Create an instance withvector().

Signature:

exportdeclareclassVectorValue

Methods

MethodModifiersDescription
fromJSON(json)staticBuilds aVectorValue instance from a JSON object created byVectorValue.toJSON().
isEqual(other)Returnstrue if the twoVectorValue values have the same raw number arrays, returnsfalse otherwise.
toArray()Returns a copy of the raw number array form of the vector.
toJSON()Returns a JSON-serializable representation of thisVectorValue instance.

VectorValue.fromJSON()

Builds aVectorValue instance from a JSON object created byVectorValue.toJSON().

Signature:

staticfromJSON(json:object):VectorValue;

Parameters

ParameterTypeDescription
jsonobjecta JSON object represention of aVectorValue instance.

Returns:

VectorValue

an instance ofVectorValue if the JSON object could be parsed. Throws aFirestoreError if an error occurs.

VectorValue.isEqual()

Returnstrue if the twoVectorValue values have the same raw number arrays, returnsfalse otherwise.

Signature:

isEqual(other:VectorValue):boolean;

Parameters

ParameterTypeDescription
otherVectorValue

Returns:

boolean

VectorValue.toArray()

Returns a copy of the raw number array form of the vector.

Signature:

toArray():number[];

Returns:

number[]

VectorValue.toJSON()

Returns a JSON-serializable representation of thisVectorValue instance.

Signature:

toJSON():object;

Returns:

object

a JSON representation of this object.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-01-15 UTC.