Closed devboy closed 6 years ago
@devboy Thanks for flagging this, we must have missed reference data types with our initial implementation.
Have you got an example of how you created the document with a reference in the first instance? It will really help us make sure we implement it correctly and add some tests.
@chrisbianca I actually created it via the Firestore UI.
Ah ok. Out of interest, what would you expect it to be once the library has loaded the data? A string? It's not clear from the Firestore docs what their expectation is
Good question. What does the web-sdk return? My expectation was for the data to be joined together...
I just checked, and the web-sdk does return a DocumentReference
Thanks for confirming! We'll have a think and try and add support for this as soon as we can
Thanks @chrisbianca
+1
Also, unable to save DocumentReferences to the database.
I tried 2 things as mentioned at https://firebase.google.com/docs/firestore/data-model#references
//first
var userref = Firebase.firestore().doc('users/1234');
//second
var userref = Firebase.firestore().collection('users').doc('1234')
//common code to user reference and save in other document
Firebase.firestore()
.collection('users')
.doc('9876')
.set({
'friends':{
'1234': userref
}
})
.then(() => {
//Success
})
@psycura I've just pushed up support for DocumentReference, Dates, GeoPoints, etc. It would be great if you could test with the latest version of the code and let me know if there are any issues before we release over the next few days.
You can install by doing the following:
npm install --save https://github.com/invertase/react-native-firebase.git
Please re-open if there are still issues with DocumentReference, or you find something else isn't working.
This is now live as part of the v3.0.3 release
Awesome. Thanks for your work!
Just ran into this and I updated. I can confirm this is working in v3.0.3, thanks for fixing this guys!
Issue
A document containing a field of type reference is
null
indata()
!users.docs[1].data() // {nickname: "ivan", friend: null}
Environment
Application Target Platform: iOS
Development Operating System: macOS
Build Tools: XCode 9
React Native version: 0.49.1
RNFirebase Version: 3.0.0
Firebase Module: Firestore