List of usage examples for org.springframework.data.mongodb.core.index CompoundIndexDefinition CompoundIndexDefinition
public CompoundIndexDefinition(Document keys)
From source file:org.cbioportal.session_service.domain.internal.SessionRepositoryImpl.java
@Override public void saveSession(Session session) { if (!this.mongoTemplate.collectionExists(session.getType())) { this.mongoTemplate.createCollection(session.getType()); DBObject indexKeys = new BasicDBObject(); indexKeys.put("source", 1); indexKeys.put("type", 1); indexKeys.put("checksum", 1); this.mongoTemplate.indexOps(session.getType()) .ensureIndex(new CompoundIndexDefinition(indexKeys).unique()); }/*from www . j a v a2s.c o m*/ this.mongoTemplate.save(session, session.getType()); }