SDj
SDj

Reputation: 57

Xamarin: Firebase.Firestore.FieldValue does not contain a definition for ArrayUnion

I'm currently working on a Xamarin application in iOS and Android that uses Firebase. I'm trying to add a value to an existing array in firestore. In iOS I had no problems using FieldValue.FromArrayUnion(obj). However in Android I'm having a hard time since this method does not exist. Any ideas of how can I add a value into my array without overwriting its data?

Thank you.

Upvotes: 2

Views: 184

Answers (1)

SushiHangover
SushiHangover

Reputation: 74174

Xamarin has not released a nuget package version that is binding the Firestore version that added FieldValue.arrayUnion and FieldValue.arrayRemove. Those were added in 17.0.5 and the latest version of 18.0.0, so Microsoft is a number of major/minor versions behind.

Cloud Firestore version 17.0.5

Added FieldValue.arrayUnion() and FieldValue.arrayRemove() to atomically add and remove elements from an array field in a document.

Thus the arrayUnion and arrayRemove static methods are missing in

id="Xamarin.Firebase.Firestore" version="60.1142.1"

Building that binding project from source would be your fastest option:

Upvotes: 2

Related Questions