Closed RaphaelJenni closed 6 years ago
How did you store that reference?
Through a web app.
I'm looking for iOS and Android examples for adding/retrieving references in the Firestore docs but no luck so far: https://firebase.google.com/docs/firestore/manage-data/add-data
Oh hang on, is the datatype of your favoriteStation
path/reference simply a string? Hmm, I guess not as it should have "
quotes around the value..
Ah, found a way to add a reference to the DB through the Firebase web UI. You can select the 'reference' type from the list of types, but I didn't see it before because it was only revealed after scrolling in the list..
No, it is a reference.
Yeah, see the updated comment ;)
With 5.1.3 references will be retrieved from Firestore (as well as the other new data type: Geopoint). But you won't be able to save those just yet.
Here's a demo on how to use such a reference in your app.
At least your app will no longer crash on Android when those types are encountered.
@EddyVerbruggen is support for writing references something that is planned for the near future?
@EddyVerbruggen Setting the native reference object writes the reference to fire store as expected (tested on iOS, should work on Android too).
doc.set({
refFieldName: firestore.collection(refColName).doc(refId)[platform.device.os.toLowerCase()]
})
Incase if there is a better solution, kindly suggest.
@manojdcoder, it does not work on Android. As you see below what should be references (organization & process) are objects
Im using nativescript-plugin-firebase v6.4.1
Adding support for saving references in #875.
Btw, @manojdcoder was right: it was possible that way on iOS, but not on Android.
The firestore supports references to be stored. This doesn't work with the plugin. You can't set a reference through the app and if you try to receive a reference, the app crashes.
Crash report:
Reference in the firebase console:
If I store the reference it just converts the reference to an json object