Search code examples
mongodbslug

MongoDB commenting system Slug, What is it for?


I'm reading a tutorial on MongoDB on how to model the DB for commenting system in here. One comment document has the following information:

{
    _id: ObjectId(...),
    discussion_id: ObjectId(...),
    parent_id: ObjectId(...),
    slug: '34db/8bda'
    full_slug: '2012.02.08.12.21.08:34db/2012.02.09.22.19.16:8bda',
    posted: ISODateTime(...),
    author: {
              id: ObjectId(...),
              name: 'Rick'
             },
    text: 'This is so bogus ... '
}

What I can't seem to understand is what the slug and full_slug are for, can't understand it from the document.


Solution

  • For my opinion, it looks like some kind of a URL shortcut to get the comments, for example, when you type: http://site.com/34db/8bda it will bring you the comment itself, the full-slug is for sorting and ordering the comments by the time they posted.