List of usage examples for org.springframework.data.mongodb.core.index IndexDefinition IndexDefinition
IndexDefinition
From source file:io.gravitee.repository.mongodb.ratelimit.MongoRateLimitRepository.java
@PostConstruct public void ensureTTLIndex() { mongoOperations.indexOps(RATE_LIMIT_COLLECTION).ensureIndex(new IndexDefinition() { @Override// www . ja va2s. co m public DBObject getIndexKeys() { return new BasicDBObject(FIELD_RESET_TIME, 1); } @Override public DBObject getIndexOptions() { // To expire Documents at a Specific Clock Time we have to specify an expireAfterSeconds value of 0. return new BasicDBObject("expireAfterSeconds", 0); } }); }