0

I just cannot create a desired index. I list existing indexes with

System.out.println(mongo.getCollection("User").getIndexInfo());

and still get only

[{ "v" : 1 , "key" : { "_id" : 1} , "name" : "_id_1" , "ns" : "devtest01.User"}]

I tried

mongo.getCollection("User").createIndex("syncTime");

and

Index indexDefinition = new Index("syncTime", Direction.ASC);
mongo.indexOps("User").ensureIndex(indexDefinition);

Result is still the same...

Tomasz
  • 988
  • 1
  • 9
  • 23

1 Answers1

1

The reason getIndexInfo() is returning the default_id index is because DocumentDB is automatically auto-indexing everything - including MongoDB protocol support. All paths are indexed with minimal storage and throughput costs. For more information about DocumentDB Indexes, please refer to DocumentDB Indexing Policies at https://azure.microsoft.com/en-us/documentation/articles/documentdb-indexing-policies/.

We are working on improving the response of getIndexInfo(); in the interim, you can also provide feedback directly at DocumentDB User Voice at: https://feedback.azure.com/forums/263030-documentdb.

Denny Lee
  • 3,154
  • 1
  • 20
  • 33