Assume the following data structure in MongoDB:
{
"_id" : "Bob Blocker",
"ratings" : {
"771206753" : 1
},
"prevalence" : 1
}
How could one index the keys of the internal structure of ratings using ensureIndex()? I would want to build an index that associated the document _id with any and all of the keys (in this example, "771206753") in the ratings object.
Would keying the index with ratings suffice? Wouldn't that also record the value portion of the ratings object? Should I shift my schema if lookup is intended by that particular key?