Start a new topic

Joining data collections and resolving KinveyFile reference

I am joining an entity form another collection in the onPostFetch of the collection I am querying (as suggested in recent forum post for v3 after data relationships were removed).


Both collections have Kinvey File references against entities. The file references for the primary collection (the one I am querying) get resolved and returned as file objects (with _downloadURL). The file references of the entity I join into the response body do not get resolved and only appear as {_type:KinveyFile,_id:fild_id}. 


Anyone help with getting these to resolve properly? 


Cheers

Phil


Hi Phil,


I am trying this out now. One option is to resolve all the file references one by one in BL code after fetching from the secondary collection.


Can you share a couple of sample rows from both the collections so that I can try this out on data which matches your structure?



Regards,

Wani

Hi Wani I have tried resolving in the BL but there are two problems. 1. Iterating through file refs slows down my BL. 2. Resolving in BL does not return a _downloadURL which means it doesn't work anyway. Not near computer that I can access console, can do later. Sample use case is one collection has report data and the second collection had business data (who creates the report). To populate the report with the business details I join the collections on post fetch (works) to put in the business logo I need the file stored at a kinvey ref against the business details. I know I could store the logo file ref against the report data but updating the logo file becomes complex and prone to timeouts.
Login or Signup to post a comment