DEV Community

Discussion on: Help me decide: Embed subdocument or have a new document collection?

Collapse
 
dmfay profile image
Dian Fay • Edited

It is simple! The problem is it takes time. Filtering one rep array is O(n); filtering and aggregating (for example, if you wanted to see all rep you've given) is O(n2 ). Performance may be acceptable at first but you've chosen a structure which can grow indefinitely and does not admit any shortcuts.