MongoDB is great for tagging because of this multikeys functionality
eg. suppose you create your product documents like
{ _id : 1, name : "Widget", tags: [ {color : "blue"}, {size : 10}, {foo : "bar"} ] }
Then you can create an index in the tag array and each item will be indexed. So, to find all the blue products, you can request the following:
db.Products.find({tags : {color : "blue"}});
The great thing about this: each element can have a completely different set of βtagβ attributes, and queries will be able to use an index β some may have color and size, others may have weight and height.
As for caching, in MongoDB it is important to have enough RAM to store your working set in memory (enough for all available data and indexes). Thus, the data will remain in memory, making queries very fast. Thus, you may not need caching technology from above.
source share