|
|
|
@ -25,23 +25,20 @@ import java.lang.annotation.Target; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Mark a class to use compound indexes. |
|
|
|
* Mark a class to use compound indexes. |
|
|
|
* <p /> |
|
|
|
* <p /> |
|
|
|
* Some situations may require to have more than one {@link CompoundIndex}. For those scenarios {@link CompoundIndexes} |
|
|
|
* <p> |
|
|
|
* functions as container annotation for multiple {@link CompoundIndex} annotations via the |
|
|
|
* <b>NOTE: This annotation is repeatable according to Java 8 conventions using {@link CompoundIndexes#value()} as |
|
|
|
* {@link CompoundIndexes#value()} or by repeating the {@link CompoundIndex} on the class itself. |
|
|
|
* container.</b> |
|
|
|
* |
|
|
|
|
|
|
|
* <pre> |
|
|
|
|
|
|
|
* <code> |
|
|
|
|
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* <pre class="code"> |
|
|
|
* @Document |
|
|
|
* @Document |
|
|
|
* @CompoundIndex(def = "{'firstname': 1, 'lastname': 1}") |
|
|
|
* @CompoundIndex(def = "{'firstname': 1, 'lastname': 1}") |
|
|
|
* @CompoundIndex(def = "{'address.city': 1, 'address.street': 1}") |
|
|
|
* @CompoundIndex(def = "{'address.city': 1, 'address.street': 1}") |
|
|
|
* class Person { |
|
|
|
* class Person { |
|
|
|
* String firstname; |
|
|
|
* String firstname; |
|
|
|
* String lastname; |
|
|
|
* String lastname; |
|
|
|
* |
|
|
|
* |
|
|
|
* Address address; |
|
|
|
* Address address; |
|
|
|
* } |
|
|
|
* } |
|
|
|
* </code> |
|
|
|
|
|
|
|
* </pre> |
|
|
|
* </pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Jon Brisbin |
|
|
|
* @author Jon Brisbin |
|
|
|
@ -63,9 +60,7 @@ public @interface CompoundIndex { |
|
|
|
* <br /> |
|
|
|
* <br /> |
|
|
|
* If left empty on nested document, the whole document will be indexed. |
|
|
|
* If left empty on nested document, the whole document will be indexed. |
|
|
|
* |
|
|
|
* |
|
|
|
* <pre> |
|
|
|
* <pre class="code"> |
|
|
|
* <code> |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @Document |
|
|
|
* @Document |
|
|
|
* @CompoundIndex(def = "{'h1': 1, 'h2': 1}") |
|
|
|
* @CompoundIndex(def = "{'h1': 1, 'h2': 1}") |
|
|
|
* class JsonStringIndexDefinition { |
|
|
|
* class JsonStringIndexDefinition { |
|
|
|
@ -77,7 +72,6 @@ public @interface CompoundIndex { |
|
|
|
* class ExpressionIndexDefinition { |
|
|
|
* class ExpressionIndexDefinition { |
|
|
|
* String h1, h2; |
|
|
|
* String h1, h2; |
|
|
|
* } |
|
|
|
* } |
|
|
|
* </code> |
|
|
|
|
|
|
|
* </pre> |
|
|
|
* </pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
@ -127,35 +121,31 @@ public @interface CompoundIndex { |
|
|
|
* <br /> |
|
|
|
* <br /> |
|
|
|
* The structure below |
|
|
|
* The structure below |
|
|
|
* |
|
|
|
* |
|
|
|
* <pre> |
|
|
|
* <pre class="code"> |
|
|
|
* <code> |
|
|
|
|
|
|
|
* @Document |
|
|
|
* @Document |
|
|
|
* class Root { |
|
|
|
* class Root { |
|
|
|
* Hybrid hybrid; |
|
|
|
* Hybrid hybrid; |
|
|
|
* Nested nested; |
|
|
|
* Nested nested; |
|
|
|
* } |
|
|
|
* } |
|
|
|
* |
|
|
|
* |
|
|
|
* @Document |
|
|
|
* @Document |
|
|
|
* @CompoundIndex(name = "compound_index", def = "{'h1': 1, 'h2': 1}") |
|
|
|
* @CompoundIndex(name = "compound_index", def = "{'h1': 1, 'h2': 1}") |
|
|
|
* class Hybrid { |
|
|
|
* class Hybrid { |
|
|
|
* String h1, h2; |
|
|
|
* String h1, h2; |
|
|
|
* } |
|
|
|
* } |
|
|
|
* |
|
|
|
* |
|
|
|
* @CompoundIndex(name = "compound_index", def = "{'n1': 1, 'n2': 1}") |
|
|
|
* @CompoundIndex(name = "compound_index", def = "{'n1': 1, 'n2': 1}") |
|
|
|
* class Nested { |
|
|
|
* class Nested { |
|
|
|
* String n1, n2; |
|
|
|
* String n1, n2; |
|
|
|
* } |
|
|
|
* } |
|
|
|
* </code> |
|
|
|
|
|
|
|
* </pre> |
|
|
|
* </pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* resolves in the following index structures |
|
|
|
* resolves in the following index structures |
|
|
|
* |
|
|
|
* |
|
|
|
* <pre> |
|
|
|
* <pre class="code"> |
|
|
|
* <code> |
|
|
|
|
|
|
|
* db.root.createIndex( { hybrid.h1: 1, hybrid.h2: 1 } , { name: "hybrid.compound_index" } ) |
|
|
|
* db.root.createIndex( { hybrid.h1: 1, hybrid.h2: 1 } , { name: "hybrid.compound_index" } ) |
|
|
|
* db.root.createIndex( { nested.n1: 1, nested.n2: 1 } , { name: "nested.compound_index" } ) |
|
|
|
* db.root.createIndex( { nested.n1: 1, nested.n2: 1 } , { name: "nested.compound_index" } ) |
|
|
|
* db.hybrid.createIndex( { h1: 1, h2: 1 } , { name: "compound_index" } ) |
|
|
|
* db.hybrid.createIndex( { h1: 1, h2: 1 } , { name: "compound_index" } ) |
|
|
|
* </code> |
|
|
|
|
|
|
|
* </pre> |
|
|
|
* </pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
|