I am solving this problem:
I am building an IMGUR clone, where users can upload images and there is a 'latest uploads' page that shows the last 1000 uploaded images.
- users can upload pictures as soon as they sign up, but
- until the user verifies their email address, their uploads do not show up in 'latest uploads'
- as soon as the user verified their email, their images start showing up.
- if a user is banned, their images do not show up in 'latest uploads'
Originally I had Images contain a User ref, I would select the last 1000 images populating the User. I would then iterate over the returned collection discarding images owned by banned or non-verified users. This is broken when the last 1000 images were uploaded by unverified users.
I am considering using an array of inner Image documents on the User object, but that is not ideal either because a User might own a lot of Images and I do not always want to load them when I load the User object.
I am open to any solution