Keen in mind that when you index on an array field each individual
item in the array is indexed. So you are creating an index with 100 x
40,000, or 4,000,000 entries. This is going to take awhile...
The C# driver is simply timing out because the operation did not
complete within the default timeout. You could configure a higher
timeout value, but... it is much better to run long running operations
like this from the mongo shell, and to make sure you do it at off peak
hours. When you killed mongod.exe you aborted the creation of the
index.
If you think it is taking too long to build the index then you can
file a server bug.
Regarding your concern that the elements named "0", "1", etc... are
not being created, they look fine to me. Here's a sample document as
viewed from the shell:
> db.test.findOne()
{ "_id" : ObjectId("4e847934e447ad22c44be2ea"), "1" : 1, "2" : 1,
"3" : 1, "4" : 1, "5" : 1, "6" : 1, "7" : 1, "8" : 1,
"9" : 1, "dd" : [ 0, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41,
... lots of lines omitted ...
39957, 39958, 39959, 39960, 39961, 39962, 39963, 39964,
39965, 39966, 39967, 39968, 39969, 39970, 39971,
39972, 39973, 39974, 39975, 39976, 39977, 39978, 39979,
39980, 39981, 39982, 39983, 39984, 39985, 39986,
39987, 39988, 39989, 39990, 39991, 39992, 39993, 39994,
39995, 39996, 39997, 39998, 39999 ] }