Is there anyway to import data that has relationships across collections?
I have 4 related collections - I can upload them individually - using the Data import feature but I can’t see any explanation of how the relationships between documents get imported. Is there a best practice for this?
Thanks in advance.
October 6, 2022, 4:06pm
import command in
fauna-shell does not support relations during import. This is a known problem, but we have not yet identified a great solution.
Until we do have a solution, you would have to write your own FQL queries to import the data and maintain the relations.
I will have a stab at that.
Each collection has a unique identifier so I guess I could use Match and update to loop through my data?
October 7, 2022, 3:59pm
Each collection has a unique identifier
Yes. Two collections cannot share a name, so the collection name is unique in that database. Child, peer, or parent databases might have collections with the same name though.
Match works if you have an appropriate index. If you just want to iterate through all of the documents in a collection, you can use
Note that the maximum number of documents per page is 100,000 (default is 64). If you have more documents than that, you’ll need to handle the relationship stitching with multiple queries.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.