Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB commenting system Slug, What is it for?

Tags:

mongodb

slug

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.

like image 633
Idan Shechter Avatar asked Oct 21 '12 23:10

Idan Shechter


People also ask

How to implement sharding in Mongos?

How to Implement Sharding. 1 1. Set Up the Config Server. Each config server replica set can have any number of mongod processes (up to 50), with the following exceptions: no ... 2 2. Set Up Shards. 3 3. Start the mongos. 4 4. Configure and Turn On Sharding for the Database.

How does Netlify generate slugs for content?

Since Netlify CMS is a git-based headless CMS, it will generate an actual file when creating content. By default, it generates the slug for new pages, posts or uploads based upon the title. You can configure how these slugs are generated in the site config. This doesn't give the user access to a slug field in the content though.

How do I create a slug in contentful?

Creating a Slug in Contentful Within Contentful, a slug is simply a specialized text field. The good news is that it has features like auto-populating based on the title and it validates for uniqueness. To create a slug field, first create a new text field as part of your content model.

How to create comment feature in Django?

How to create Comment Feature in Django? Open command prompt and run the following commands. Start a new django project as: After executing this command you will see following files and folder that django creates for you.


1 Answers

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.

like image 177
udidu Avatar answered Sep 27 '22 20:09

udidu