views:

68

answers:

1

Howdy guys,
I'm pretty new to mongodb (only work with it for one small project) and I wanted to have your tips on how to organize my documents. My brain is not (yet) nosql formatted.

I have a collection storing all kind of informations and I want to add tags to it. There will be 1-5 tags by document. I want to be able to search by tags (among other things), display all the documents for 1 or more given tags, know the number of documents by tag.

What do you think is the best way to approach this simple problem ? should I give it his own collection ? should I embed it ?

How would you do ?

Thanks

+1  A: 

Embed the tags in the document. You can search on embedded arrays and you can index them.

TTT