Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Firestore: update with arrayUnion doesn't accept POJO #5622

@abchugh

Description

@abchugh

Writing this POJO works in other APIs but fails in ArrayUnion updates.

Exception thrown

java.lang.reflect.InvocationTargetException: Cannot convert org.wizgraph.backend.data.common.ResourcePointer@7f6c897b to Firestore Value

Environment details

Java version: 8
Firestore maven version:

<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-firestore</artifactId>
<version>1.10.0</version>

Code example

  public static void updateStarredFramework(
      DocumentReference ref, String fieldName, ResourcePointer ptr) throws Exception {
    FieldValue updateValue = FieldValue.arrayUnion(ptr);
    ref.update(fieldName, updateValue).get();
  }

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the Firestore API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions