Let’s take this models:
User
- name
Product
- name
- category
List
- name
- creation_date
- user (reference)
Product_List
- list ( reference)
- product ( reference)
How can I retrieve a list of the products that remain out of the list?
-
Should I retrieve them all and then delete them programmatically ( doesn’t this make the request slower? )
- Get all the products of a certain list of a certain user
- Get all the products
- Extract the difference ( a nested for? )
Sorry, I’m kind of newbie on this, suggestions and comments are welcome!
Thanks!
If you structure your data like this:
Then you can retrieve the products not in a list like this:
missing_productsis a set of keys, which you can pass todb.getto retrieve the corresponding product entities.This will, of course, require retrieving the entire list of products, but this is exactly what a relational database would have to do to satisfy the query too.