Ahh, when reading your mail, in your second paragraph you were
referring to the attached document which caused me to completely skip
your last paragraph in which you described exactly what I tried to
say. I did exactly what support staff from all over the world do: not
reading the question carefully. I apologize. I do have one more
thought, although it comes with a couple of assumptions:
1. Your running MongoDB 1.8+
2. When you want to sort on Bob's publication date, you don't want to
return any documents Bob didn't contribute to
3. The number of authors is relatively limited
If these three hold you might be able to create a sparse index per
author, assuming you don't run into the namespace limit (http://
www.mongodb.org/display/DOCS/Using+a+Large+Number+of+Collections).
Otherwise as axifu noted, you might want to elaborate more on your
problem as there's always a chance this may be an XY-problem
On Sep 19, 6:24 pm, Jamey Wood <
jamey.w...@gmail.com> wrote:
> Thanks for responding! What you note below is the same possibility I was
> referencing when I mentioned using a map instead of an array. But if it
> isn't possible to construct indexes that the sorts will use with that
> approach (as we both noted), I don't think it's a viable solution for
> anything but trivially-small datasets.
>
> So if I'm understanding things correctly, I'm in a bit of a catch-22:
>
> - If I use a nested array, I can construct efficient indexes--but can't
> express a proper query to use them
> - If I use a nested object, I can express the query I'm seeking--but
> can't construct indexes to make it efficient
> - If I get rid of the nesting entirely (and use a separate collection for