I have 3 collections interconnected through many-to-many relationships. Therefore, I have 2 concerns:
For most scenarios, I'd probably have the referencing IDs on each of the objects, like this:
{
"_id": "123",
"firstReferenceCollectionId": "abc",
"secondReferenceCollectionId": "def"
}
If your application is going to have massive scale, I'd probably further denormalize the data based on how it's actually being used.
To answer your second question, you really shouldn't need to worry about that with the above approach, since the internal id of the reference won't change when other properties on those objects change. If you go the route of additional denormalization, use meteor add matb33:collection-hooks
to sync up data on upserts. Here's the documentation link: https://github.com/matb33/meteor-collection-hooks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.