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?