Question about compound keys

Thank for your reply @nraboy!

  1. I guess I don’t have to worry then!

  2. I don’t have to have duplicate product data, so I prefers to store them as product Id only. Updating a product require to update all the user’s productviewed sounds difficult…

  3. I think we are not going to use N1QL Query as is still in beta, so probably View only.
    Then I will get the posts of a particular user using view like the following?

say user is
user::1001
{
“type”:“user”,
“name”:“Foo”
}

post is
user::1001::post::1
{
“type”:“post”,
“title”:"Foo,
“content”:“Bar”
}

I can create view to give me post only by:
function (doc, meta)
{
if (doc.type == ‘post’)
{
var userid = meta.id.substr(0, meta.id.indexOf(’::post::’));
emit(userid, doc.title);
}
}

Then I can get the list of posts?
But to in order for me to get the detail of the post, instead of using
emit(userid, doc.title);
I should use
emit(userid, meta.id);
So then I will have post id to of the post and be able to do Delete/Update as well.
Is this the correct way to do?

=====
EDIT

Actually for 3, I notice it already does return the ID for post itself, so for value I will should emit the whole doc?
For example, in a forum to display all the post and the content for the post, I will required to have post’s Title, post’s Content, post’s DateTime.
In the webinar Index and View) it said better not emit the whole doc (I don’t really understand why…), then I should just use iterate each post ID and do get document for each post seperately?
I am just thinking if I emit the post’s doc will be easier…