2016-09-27 37 views
0

我只是無法創建所需的索引。我列出與無法使用Spring MongoTemplate在Azure DocumentDB中創建索引

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

和仍然存在的索引只得到

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

我試圖

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

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

結果還是一樣...

回答

1

getIndexInfo()返回default_id索引的原因是DocumentDB自動自動索引所有內容 - 包括MongoDB協議支持。所有路徑都以最小的存儲和吞吐量成本索引。有關DocumentDB索引的更多信息,請參閱DocumentDB索引策略https://azure.microsoft.com/en-us/documentation/articles/documentdb-indexing-policies/

我們正在努力改進getIndexInfo()的響應。在此期間,您還可以直接在DocumentDB用戶語音提供反饋:https://feedback.azure.com/forums/263030-documentdb