Morphia not applying sparse option to my index
问题 I'm trying to use Morphia to interface with MongoDB, and my Morphia entity looks like this: @Entity(some params about storing the entity) public class Entity implements Serializable { <Some other fields here> @Indexed(options = @IndexOptions(unique = true, sparse = true) ) private String field; <Some other fields here> } I would like this field to be unique if present, but not required (and not unique if not present; multiple entries should be able to exclude this field). My understanding of