I have the following Mongodb database structure:
{
"_id" : "519817e508a16b447c00020e",
"keyword" : "Just an example query",
"rankings" :
{
results:
{
"1" : { "domain" : "example1.com", "href" : "http://www.example1.com/"},
"2" : { "domain" : "example2.com", "href" : "http://www.example2.com/"},
"3" : { "domain" : "example3.com", "href" : "http://www.example3.com/"},
"4" : { "domain" : "example4.com", "href" : "http://www.example4.com/"},
"5" : { "domain" : "example5.com", "href" : "http://www.example5.com/"},
...
...
"99" : { "domain" : "example99.com", "href" : "http://www.example99.com/"}
"100" : {"domain" : "example100.com", "href" : "http://www.example100.com/"}
},
"plus":"many",
"other":"not",
"interesting" : "stuff",
"for": "this question"
}
}
In a previous question, I asked how to index the text so that I could search for the keyword and domain using for example:
db.ranking.find({ $text: { $search: "\"example9.com\" \"Just an example query\""}})
The awesome answer by John Petrone was:
db.ranking.ensureIndex(
{
"keyword": "text",
"rankings.results.1.domain" : "text",
"rankings.results.2.domain" : "text",
...
...
"rankings.results.99.domain" : "text",
"rankings.results.100.domain" : "text"
}
However, if that works just great when I have 10 results, I run into an "Index key pattern too large" error with code 67 from Mongo shell when I try to index 100 results.
So the big question is:
How (the hell) can I resolve that "index key pattern too large" error?
EDIT: 18/08/2014 The document structure clarified
{
"_id" : "519817e508a16b447c00020e", #From Mongodb
"keyword" : "Just an example query",
"date" : "2014-03-28"
"rankings" :
{
"1" : { "domain" : "example1.com", "href" : "http://www.example1.com/", "plus" : "stuff1"},
...
"100" : {"domain" : "example100.com", "href" : "http://www.example100.com/"plus" : "stuff100"}"}
},
"plus":"many",
"other":"not",
"interesting" : "stuff",
"for": "this question"
}