我只是无法创建所需的索引。我列出了现有的索引
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);
结果还是一样...