index
![[spring] SpringBoot mongodb 인덱싱 안되는 문제 (SpringBoot mongodb Unique index not created)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fcza4A3%2FbtrBOvbxqc3%2FSAz2lTmMhLNMR3MxhCiAh0%2Fimg.png)
[spring] SpringBoot mongodb 인덱싱 안되는 문제 (SpringBoot mongodb Unique index not created)
embedded mongodb를 사용해 테스트를 진행했다. 인덱스가 중복되는 Entity를 저장하려 할 경우에 DuplicateKeyException 에러를 던질 줄 알았지만.. 아무일도 일어나지 않았다. @Document(collection = "products") @NoArgsConstructor @Getter @Setter public class ProductEntity { @Id private String id; @Version private Integer version; @Indexed(unique = true) private int productId; ... } 테스트에 사용중인 Entity의 일부이다. productId에 @Indexed 어노테이션을 unique = true 로 걸어주었다. ..