|
I am unable to reproduce this.
I created a standalone application (see attached) to test this and the index was in fact created properly. After running the test program I verified that the index was created using the shell:
> db.orders.getIndexes()
|
[
|
{
|
"v" : 2,
|
"key" : {
|
"_id" : 1
|
},
|
"name" : "_id_",
|
"ns" : "test.orders"
|
},
|
{
|
"v" : 2,
|
"key" : {
|
"UserId" : 1,
|
"CompanyId" : 1
|
},
|
"name" : "UserId_1_CompanyId_1",
|
"ns" : "test.orders"
|
}
|
]
|
>
|
The second index is a compound index that includes both keys.
|