'Insert a value as a reference type to Firestore using the REST API?

When trying to create or update a document which contains a reference type field, the value sent over the document API (https://firebase.google.com/docs/firestore/reference/rest#rest-resource:-v1.projects.databases.documents) is stored as string, rather than a document reference.

The most similar question I've found is this Insert a value as a reference type to Firestore (Retool), but this is only useful for retool.

This is an example of the object for the "fields" key in the body of the request

 {
    "datetime_visit":1649431229,
    "visited_partner":"partners/randomID",
    "ticket_amount":null
    "estatus":"Por asignar"
}   

I´m expecting that "visited_partner" field is inserted as a document reference. Here an example. Instead, it is inserted as a string.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source