I kinda need all comments to have unique ids, whether they're a reply to another or not. All of them. The JS code and default page sorting depends on this and it would be a lot of work to rewrite those.
My aggregates are User, Comment, Comparison. Each comparison has two topics; each topic within a comparison has comments; A user has several comments and needs to be notified of new replies; I want to show the user on where the reply was posted, so a join with Comparison (the topic's name is denormalized).
These are the relevant model classes: http://codepaste.net/d6bafjSo I need to get all comments which are a reply to user/1234`s comments (ReplyTo is not null), including the comparison they're posted on (ids and names of both topics), as well as the information of the user who wrote the reply (this is denormalized in the User.Ref class, so not an issue).
On Mon, Aug 20, 2012 at 5:37 PM, Mircea Chirea <chirea...@gmail.com> wrote:
I kinda need all comments to have unique ids, whether they're a reply to another or not. All of them. The JS code and default page sorting depends on this and it would be a lot of work to rewrite those.
As I said, you don't need to have a separate doc for each reply to give them unique ids.
My aggregates are User, Comment, Comparison. Each comparison has two topics; each topic within a comparison has comments; A user has several comments and needs to be notified of new replies; I want to show the user on where the reply was posted, so a join with Comparison (the topic's name is denormalized).
These are the relevant model classes: http://codepaste.net/d6bafjSo I need to get all comments which are a reply to user/1234`s comments (ReplyTo is not null), including the comparison they're posted on (ids and names of both topics), as well as the information of the user who wrote the reply (this is denormalized in the User.Ref class, so not an issue).
Model comments like this:
public class Comment
{
public Comment[] Replies;
}
Otherwise, you are going to have to do two queries to do this, and you probably don't want to go there.
On Mon, Aug 20, 2012 at 5:37 PM, Mircea Chirea <chirea...@gmail.com> wrote:
I kinda need all comments to have unique ids, whether they're a reply to another or not. All of them. The JS code and default page sorting depends on this and it would be a lot of work to rewrite those.
As I said, you don't need to have a separate doc for each reply to give them unique ids.I can't find exactly how to have a globally unique id for each reply; globally unique as no other document has the same ID, so not unique only with one comment. That was I can easily load all of them, reply or not and make sure the rest of the code is oblivious of their status. Unless of course you have a better idea; since I'm rewriting almost all database access code I can rewrite it in any way.
My aggregates are User, Comment, Comparison. Each comparison has two topics; each topic within a comparison has comments; A user has several comments and needs to be notified of new replies; I want to show the user on where the reply was posted, so a join with Comparison (the topic's name is denormalized).
These are the relevant model classes: http://codepaste.net/d6bafjSo I need to get all comments which are a reply to user/1234`s comments (ReplyTo is not null), including the comparison they're posted on (ids and names of both topics), as well as the information of the user who wrote the reply (this is denormalized in the User.Ref class, so not an issue).
Model comments like this:
public class Comment
{
public Comment[] Replies;
}
Otherwise, you are going to have to do two queries to do this, and you probably don't want to go there.Right. That wouldn't be a problem assuming the ID issue has an easy fix.The thing is, how do I query all comments? I wan thinking of this index, but `Hierarchy` is not found:Map = comments => from c in commentslet all = Hierarchy(c, "Replies").Union(new[] { c })from x in allselect x;