-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Posts with categories #196
Comments
Hi @vitalijm That said: [
{
"id": 1,
"name": "Cat name 1",
"posts": [
{
"id": 1,
"name": "Post title 1"
},
{
"id": 2,
"name": "Post title 2"
},
{
"id": 53,
"name": "Post title 53"
}
]
}
] With this solution you are able to show all posts with their titles in the category page without any joins or additional requests. If you decide to use a relational approach, SleekDB supports it with joins out of the box. I found an "not that bad" blog post regarding this topic, if my explanation was not enough: PS: Pagination is no problem with SleekDB as you can see in this example: Hope I able to answer your questions and help you. |
thanks for explanation |
@vitalijm You are welcome. |
Hello, thanks for very helpful plugin.
One question here is: how better organize posts with categories [logic]?
Maybe someone have example of similar logic: "Posts with categories"?
Thanks
=============================
My some thoughts on solving this "problem":
categories store:
top_category json:
[ { "id": 1, "name": "Cat name 1", "posts": [ 1, 5, 7, 10, 100 ] } ]
sub_category json:
[ { "id": 2, "parent": [ 1, 3 ], "name": "Cat name 2", "posts": [ 1, 10, 20, 23 ] } ]
posts store:
post json:
[ { "id": 1, "name": "Post title 1", "cats": [ 1, 2, 3 ], "other_val": "some_val" } ]
The text was updated successfully, but these errors were encountered: