doctrine/mongodb-odm — pull request #217 by spantaleev (2011-12-23 18:49:48+00:00)
Title: Preserve index keys ordering when dealing with referenced documents.

By design, indexes for document reference fields get modified.
Example: {"referenceField": 1} gets changed to {"referenceField.$id": 1}.

This only worked okay when the index is on a single key.
An index for {"referenceField": 1, "other": 1}
used to incorrectly change to {"other": 1, "referenceField.$id": 1}.

The new code takes care to preserve the order of multi-key indexes.