I am new to firestore as well as NoSQL. I want to make a simple database which is somewhat relational, with two tables, In terms of relational databases, one is operational (patients) and one is a transactional (readings) table.
I have an app that generates data for a patients table and a readings table. One app instance may contain data of many unique patients and each patients may have different readings in the readings table.
In Firestore I plan to achieve this by making two collections, for each of the tables mentioned and bulk upload documents for each patient and reading in the corresponding collection. Now every time I do a bulk upload to the firestore, I want to check if all the fields in the input patient JSONObjects exist in the patient collection than pick up the patientID else, make a new patient, and generate an ID and enter the reading with the given patientID.
I tried to do this with transactions but that only works for a single document, as mentioned here, (Can we not query collections inside transactions?) With Batch only set(), update() and delete() operations are possible as mention in the documentation, with batchget too we can only search using the document ID and not the fields.
Is there any way I can do this, are there any issues with the schema?