Collection Indexes

Collection Indexes

 Collection indexes can be specified with index builder that provides simple expressive syntax.

 Index examples (assuming `import collection.Order._`):
 Simple one key index : index("foo" -> Ascending) ({ "foo" : 1},{ })
 Simple two key index : index("foo" -> Ascending, "boo" -> Descending) ({ "foo" : 1 , "boo" : -1},{ })
 Index to be build in background : index("foo" -> Ascending).background(true) ({ "foo" : 1},{ "background" : true})
 Index that is unique : index("foo" -> Ascending).unique(true) ({ "foo" : 1},{ "unique" : true})
 Index that has name : index("foo" -> Ascending).name("indexName") ({ "foo" : 1},{ "name" : "indexName"})
 Index that drop dups : index("foo" -> Ascending).dropDups(true) ({ "foo" : 1},{ "dropDups" : true})
 Index that is sparse : index("foo" -> Ascending).sparse(true) ({ "foo" : 1},{ "sparse" : true})
 Index that expires document after some time : index("foo" -> Ascending).expireAfterSeconds(10) ({ "foo" : 1},{ "expireAfterSeconds" : 10})
 Index that is version 1 : index("foo" -> Ascending).version(1) ({ "foo" : 1},{ "v" : 1})
 Index that has weight on items == 2 : index("foo" -> Ascending).weights("items" -> 2) ({ "foo" : 1},{ "weights" : { "items" : 2}})
 Index that has default language english : index("foo" -> Ascending).defaultLanguage("english") ({ "foo" : 1},{ "defaultLanguage" : "english"})
 Index that has override default language : index("foo" -> Ascending).languageOverride("english") ({ "foo" : 1},{ "languageOverride" : "english"})
 Chained builder (sparse,unique,named) : index("foo" -> Ascending).sparse(true).unique(true).name("indexName") ({ "foo" : 1},{ "sparse" : true , "unique" : true , "name" : "indexName"})

Total for specification IndexBuilderSpec
Finished in39 ms
Results13 examples, 0 failure, 0 error