Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6838315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:34:54+00:00 2026-05-26T23:34:54+00:00

I am playing around with mongodb and I find myself constantly thinking RDBMS and

  • 0

I am playing around with mongodb and I find myself constantly thinking RDBMS and I would need your help to get my head out of this.

So I have a document which I would like to tag. As every documentation/example mentions, I will embed the tags on the document. However my next though would be, where to save the slug (from that tag).

Should in each document instead of saving something like

["tag1", "this is tag 2"]

to save it like:

[{ "slug": "tag1", "tag": "tag1" }, { "slug": "this-is-tag-2", tag: "this is tag 2" }]

Or should I have another collection containing a unique tag to slug matching? (Thus having to query that first before getting all the documents with slug “this-is-a-tag-2”?)

Isn’t saving the slag in the document a waste of space (considering that the relation is constantly the same?) and maybe a performance overhead when querying the collection?

How would you go about it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:34:55+00:00Added an answer on May 26, 2026 at 11:34 pm

    It depends on what you are trying to accomplish. In RDBMS, you search for the one true data structure in the n th normal form. There is no such ‘correct’ data structure for a specific set of data in a document store — to find a good data structure, you must ask yourself: what do my queries look like? Will I read much more often than I insert?

    For instance, a problematic query with embedding would be: “show the tags that were used, sorted by popularity”, or even worse “show the tags used by my friends sorted by popularity”. To perform the former query quickly, you must keep track of the available tags and the number of references somewhere else. For the latter, you should use an RDBMS.

    Tagging is one of the rare cases where I’d usually go for embedding, because typically tags don’t change too often and there’s no need to have some kind of referential integrity (i.e. you can’t change ‘a tag’). But it depends on what you’re tagging and who’s doing it.

    I also don’t understand what slug is good for: if you need something you can search for, you could simply remove special chars and whitespaces and make this a lowercase string on insert?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm playing around with mongodb (documentation isn't very complete): tmpQuery = collection.find({title_full: kdsljfklsadfklj}) print
Playing around with MongoDB and NoRM in .NET. Thing that confused me - there
been playing around with ResolveClientUrl(~/Confirmation.aspx) and other methods.. I am tryin go get the
I've been playing around storing tweets inside mongodb, each object looks like this: {
Im playing around with the Tablesorter plug-in for jQuery and was trying to get
I'm playing around with some code katas and trying to get a better understanding
I was playing around with mongodb on PHP and I noticed something strange, look
After playing around with URL decoding myself, I managed to come up with some
been playing around with Capistrano to get an automated deploy between my server and
I am currently playing around with node.js and MongoDB using the node-mongo-native driver. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.