|
|
|
@ -374,22 +374,6 @@ public class MongoPersistentEntityIndexResolverUnitTests { |
|
|
|
assertIndexPathAndCollection(new String[] { "foo", "bar" }, "CompoundIndexOnLevelZero", indexDefinitions.get(0)); |
|
|
|
assertIndexPathAndCollection(new String[] { "foo", "bar" }, "CompoundIndexOnLevelZero", indexDefinitions.get(0)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @see DATAMONGO-963 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void compoundIndexShouldIncludeTTLWhenConsistingOfOnlyOneKey() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(CompoundIndexWithOnlyOneKeyAndTTL.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IndexDefinition indexDefinition = indexDefinitions.get(0).getIndexDefinition(); |
|
|
|
|
|
|
|
assertThat( |
|
|
|
|
|
|
|
indexDefinition.getIndexOptions(), |
|
|
|
|
|
|
|
equalTo(new BasicDBObjectBuilder().add("unique", true).add("dropDups", true).add("sparse", true) |
|
|
|
|
|
|
|
.add("background", true).add("expireAfterSeconds", 10L).get())); |
|
|
|
|
|
|
|
assertThat(indexDefinition.getIndexKeys(), equalTo(new BasicDBObjectBuilder().add("foo", 1).get())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Document(collection = "CompoundIndexOnLevelOne") |
|
|
|
@Document(collection = "CompoundIndexOnLevelOne") |
|
|
|
static class CompoundIndexOnLevelOne { |
|
|
|
static class CompoundIndexOnLevelOne { |
|
|
|
|
|
|
|
|
|
|
|
@ -404,16 +388,16 @@ public class MongoPersistentEntityIndexResolverUnitTests { |
|
|
|
|
|
|
|
|
|
|
|
@Document(collection = "CompoundIndexOnLevelZero") |
|
|
|
@Document(collection = "CompoundIndexOnLevelZero") |
|
|
|
@CompoundIndexes({ @CompoundIndex(name = "compound_index", def = "{'foo': 1, 'bar': -1}", background = true, |
|
|
|
@CompoundIndexes({ @CompoundIndex(name = "compound_index", def = "{'foo': 1, 'bar': -1}", background = true, |
|
|
|
dropDups = true, expireAfterSeconds = 10, sparse = true, unique = true) }) |
|
|
|
dropDups = true, sparse = true, unique = true) }) |
|
|
|
static class CompoundIndexOnLevelZero {} |
|
|
|
static class CompoundIndexOnLevelZero {} |
|
|
|
|
|
|
|
|
|
|
|
@CompoundIndexes({ @CompoundIndex(name = "compound_index", background = true, dropDups = true, |
|
|
|
@CompoundIndexes({ @CompoundIndex(name = "compound_index", background = true, dropDups = true, sparse = true, |
|
|
|
expireAfterSeconds = 10, sparse = true, unique = true) }) |
|
|
|
unique = true) }) |
|
|
|
static class CompoundIndexOnLevelZeroWithEmptyIndexDef {} |
|
|
|
static class CompoundIndexOnLevelZeroWithEmptyIndexDef {} |
|
|
|
|
|
|
|
|
|
|
|
@Document(collection = "CompoundIndexOnLevelZero") |
|
|
|
@Document(collection = "CompoundIndexOnLevelZero") |
|
|
|
@CompoundIndex(name = "compound_index", def = "{'foo': 1, 'bar': -1}", background = true, dropDups = true, |
|
|
|
@CompoundIndex(name = "compound_index", def = "{'foo': 1, 'bar': -1}", background = true, dropDups = true, |
|
|
|
expireAfterSeconds = 10, sparse = true, unique = true) |
|
|
|
sparse = true, unique = true) |
|
|
|
static class SingleCompoundIndex {} |
|
|
|
static class SingleCompoundIndex {} |
|
|
|
|
|
|
|
|
|
|
|
static class IndexDefinedOnSuperClass extends CompoundIndexOnLevelZero { |
|
|
|
static class IndexDefinedOnSuperClass extends CompoundIndexOnLevelZero { |
|
|
|
@ -422,17 +406,11 @@ public class MongoPersistentEntityIndexResolverUnitTests { |
|
|
|
|
|
|
|
|
|
|
|
@Document(collection = "ComountIndexWithAutogeneratedName") |
|
|
|
@Document(collection = "ComountIndexWithAutogeneratedName") |
|
|
|
@CompoundIndexes({ @CompoundIndex(useGeneratedName = true, def = "{'foo': 1, 'bar': -1}", background = true, |
|
|
|
@CompoundIndexes({ @CompoundIndex(useGeneratedName = true, def = "{'foo': 1, 'bar': -1}", background = true, |
|
|
|
dropDups = true, expireAfterSeconds = 10, sparse = true, unique = true) }) |
|
|
|
dropDups = true, sparse = true, unique = true) }) |
|
|
|
static class ComountIndexWithAutogeneratedName { |
|
|
|
static class ComountIndexWithAutogeneratedName { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Document(collection = "CompoundIndexWithOnlyOneKeyAndTTL") |
|
|
|
|
|
|
|
@CompoundIndex(def = "{'foo': 1}", background = true, dropDups = true, expireAfterSeconds = 10, sparse = true, |
|
|
|
|
|
|
|
unique = true) |
|
|
|
|
|
|
|
static class CompoundIndexWithOnlyOneKeyAndTTL { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static class TextIndexedResolutionTests { |
|
|
|
public static class TextIndexedResolutionTests { |
|
|
|
|