Tuesday, June 19, 2012

spring-data document mongodb does not recreate your indexes after a mongoTemplate.getDb().dropDatabase()

I'm using spring-data mongodb and I wanted to do well so I've made some unit tests to verify my queries their performances against indexes. Instead of doing a removeAll form each collections, I though it will be quicker to do a mongoTemplate.getDb().dropDatabase(). Big mistakes !! Dropping the database remove everything and indexes of courses. I though they were recreate by spring-data, and it is not. So, removeAll on collection repository will do it.

1 comment: