extending to my question Firestore - How to model and query relation of 2 collections - IOT use case
I'ved now seen a video on this, and this recommends modelling relations using document ID. https://www.youtube.com/watch?v=jm66TSlVtcc skip to 6:07
I want to know if it would work in this case (modifying the example from my original question to fit to this youtube recommendation of firestore relation:
Eg: I have 2 different collection - tracking and venue
tracking <-- collection
1. document(xyz123)
venueId = "abcd1234"
timestamp = 10/09/2019 10:00
2. document(xyz567)
venueId = "efgh3456"
timestamp = 10/09/2019 11:00
venue <-- collection
1. document(abcd1234) <-- notice i shift the device_unique_identifier here instead
name = "room A"
// device_unique_identifier = "abcd1234" <-- this is unique name
2. document(efgh3456) <-- notice i shift the device_unique_identifier here instead
name = "room B"
// device_unique_identifier = "efgh3456" <-- this is unique name
Main question: I would like to query document xyz123 and get the name of the venue in the row. So the output would be:
document(xyz123)
device_unique_identifier = "abcd1234"
timestamp = 10/09/2019 10:00
venue.name = "room A"
On another possible extra question, when inserting the tracking data, would it be possible to auto insert the venue data as an object in firestore backend without the need to query venue the data ?