Code:
mongoTemplate.execute("publicfeed",new CollectionCallback<PublicFeed>() {
@Override
public PublicFeed doInCollection(DBCollection dbc) throws MongoException, DataAccessException {
log.info("Listing Indexes....");
List<DBObject> indexes = dbc.getIndexInfo();
for (DBObject index: indexes) {
log.info("Index: " + index);
}
log.info("Dropping Index....");
dbc.dropIndex("findByLinkId");
log.info("Listing Indexes....");
indexes = dbc.getIndexInfo();
for (DBObject index: indexes) {
log.info("Index: " + index);
}
return null;
}
});
However disappointed to find the exact same result...
Code:
13:50:29,268 INFO .feed.api.test.PublicFeedIntegrationTest: 69 - Test Add Dups.....
13:50:29,268 DEBUG ent.mongodb.repository.MongoQueryCreator: 114 - Created query { "linkId" : "some-id-for"}
13:50:29,268 DEBUG work.data.document.mongodb.MongoTemplate:1004 - find using query: { "linkId" : "some-id-for"} fields: null for class: class spot.feed.api.model.PublicFeed
13:50:29,270 INFO .feed.api.test.PublicFeedIntegrationTest: 74 - Listing Indexes....
13:50:29,271 INFO .feed.api.test.PublicFeedIntegrationTest: 77 - Index: { "name" : "_id_" , "ns" : "feed-db.publicfeed" , "key" : { "_id" : 1}}
13:50:29,271 INFO .feed.api.test.PublicFeedIntegrationTest: 77 - Index: { "name" : "linkId_1" , "ns" : "feed-db.publicfeed" , "dropDups" : false , "sparse" : false , "unique" : true , "key" : { "linkId" : 1}}
13:50:29,272 INFO .feed.api.test.PublicFeedIntegrationTest: 77 - Index: { "name" : "findByLinkId" , "ns" : "feed-db.publicfeed" , "key" : { "linkId" : -1}}
13:50:29,272 INFO .feed.api.test.PublicFeedIntegrationTest: 79 - Dropping Index....
13:50:29,274 INFO .feed.api.test.PublicFeedIntegrationTest: 81 - Listing Indexes....
13:50:29,275 INFO .feed.api.test.PublicFeedIntegrationTest: 84 - Index: { "name" : "_id_" , "ns" : "feed-db.publicfeed" , "key" : { "_id" : 1}}
13:50:29,275 INFO .feed.api.test.PublicFeedIntegrationTest: 84 - Index: { "name" : "linkId_1" , "ns" : "feed-db.publicfeed" , "dropDups" : false , "sparse" : false , "unique" : true , "key" : { "linkId" : 1}}
13:50:29,275 INFO .feed.api.test.PublicFeedIntegrationTest: 89 - Haris Feed PublicFeed{id=4dcc481561b7debcfdb4922d, title=Hari's Feed, description=Follow Hari on his world trip, usage=null, linkId=some-id-for, daysRange=14, devices=[], features=[]}
13:50:29,276 DEBUG work.data.document.mongodb.MongoTemplate: 792 - save DBObject containing fields: [linkId, title, description, features, devices, daysRange]
13:50:29,276 INFO .feed.api.test.PublicFeedIntegrationTest: 92 - Haris Feed PublicFeed{id=4dcc481561b7debcfeb4922d, title=Hari's Feed, description=Follow Hari on his world trip, usage=null, linkId=some-id-for, daysRange=14, devices=[], features=[]}
13:50:29,277 INFO .feed.api.test.PublicFeedIntegrationTest: 93 - Test Add Dups - Done