that's intended, so the descendants of each comment sort together, e.g.:

c0
c0 c01
c0 c01 c010
c0 c01 c011
c0 c02
c0 c02 c020
c1
c1 c10
...


On Mon, Sep 16, 2013 at 6:06 PM, Greg Price <notifications@github.com>wrote:

> In models/comment.rb:
>
> > @@ -17,8 +17,18 @@ class Comment < Content
> >    field :at_position_list, type: Array, default: []
> >
> >    index({author_id: 1, course_id: 1})
> > -
> > -
> > +
> > +  field :sk, type: Hash, default: {}
> > +  before_create :set_sk
> > +  def set_sk()
> > +    # Warning: this depends on Mongoid::Tree having already set parent_ids
> > +    if self.parent_ids.length==0 then
> > +      self.sk = {"p0" => self.id}
> > +    else
> > +      self.sk = Hash[self.parent_ids.each_with_index.map { |v, i| ["p#{i}", v] }]
>
> This means that a top-level comment and each of its children will have the
> same sk
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/edx/cs_comments_service/pull/51/files#r6391059>
> .
>