I register the various actions that users do on our website. Each action can be of a different type: comment, search query, page view, voting, etc. Each of these types has its own schema and general information. For instance:
comment : {"_id":(mongoId), "type":"comment", "date":4/7/2012, "user":"Franck", "text":"This is a sample comment"} search : {"_id":(mongoId), "type":"search", "date":4/6/2012, "user":"Franck", "query":"mongodb"} etc...
Basically, in OOP or RDBMS, I would develop an Action class / table and a set of inherited classes / tables (comment, search, vote).
Since MongoDb is smaller than a schema, I tend to set up a unique collection ("Actions"), where I would save these objects instead of several collections (a collection of Actions + collection Comments with a link key to its parent Action, etc ...).
My question is: what about runtime / response if I try to search on specific columns?
As I understand it, indexing best practices, if I want "every user to search mongodb", I would index the columns "type" + "query". But this will not concern the entire data set, only for the "search" type.
Will the MongoDb mechanism check the entire table or just focus on data having this particular schema?