MongoDB: индекс с двумя полями и индекс поля документа

I need to index a collection by two fields (unique index), say field1 and field2. What's better approach in terms of performance:

  1. Create a regular two-column index

    -or -

  2. Combine those two fields in a single document field {field1 : value, field2 : value2} and index that field?

Note: I will always be querying by those two fields together.

6
задан Andrey 18 May 2011 в 21:25
поделиться