![]() Index over that, then retrieve the data of the actual collection with a map get. For retrieval of data over multiple collections based on specific metadata of a project, have a separate collection with a unique document per project that contains metadata and refers to the specific collection that contains the actual project data (collections are documents, you can store a reference to a collection as well).It expect it’ll cost more reads though if I’m not mistaken. Create an index per collection and write your query as a union of these different index results. ![]() However, you currently have this model so here are a few things you could do: I personally would advise you to move to the other model in case you often have new projects and need to index over all projects. It would indeed be incredibly easy like that and is definitely much harder when all documents are in one collection (in that case I would have one project document, soft-delete that and then have an async process clean up all related project documents). Purging a project is something I didn’t think of. Isolation is often the reason why Fauna users model like that, but it definitely is a trade-off. The only other reason I could possibly think of why they were in separate collections was so that the data wouldn’t accidentally be leaked, or that if a projected needed purging its collection would just be completed. I definitely see the appeal to put everything into one collection, it would also drastically simplify the other indexes that each collection has to have for themselves.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |