Another parent/child question with a many-to-1 relationship

I was using nested documents which grew to be unmanageable, so I started prototyping using parent/child.

Here's a problem I came across:

  • a user can post comments to several topics, a topic being the parent and users the children
  • in a nested doc model, topic A contains all its children independently of topic B. i.e. we dup a user profile for every topic he posted to
  • in a parent/child model, a user posting to topic A and topic B can have a 'different' parent depending on the last topic he posted to.

How best to model this? Thanks.

One possible solution that I am thinking of is to use a composite id for the user's _id.

e.g. child_id = A.1 is really user id 1 in topic A, and
child_id = B.1 is user id 1 in topic B

I would not have unique children and the overhead would be essentially duplicate children.