const classafMongo::Index
sys::Obj afMongo::Index
Represents a MongoDB index.
- ASC
const static Int ASC := 1Use in
keyarguments to denote sort order.- DESC
const static Int DESC := -1Use in
keyarguments to denote sort order.- create
This create(Str:Obj key, Bool? unique := (Bool?)false, Str:Obj options := ([Str:Obj])[:])Creates this index.
keyis a map of fields to index type. Values may either be the standard Mongo1and-1for ascending / descending or the stringsASC/DESC.@see http://docs.mongodb.org/manual/reference/command/createIndexes/
- drop
This drop(Bool checked := true)Drops this index.
@see http://docs.mongodb.org/manual/reference/command/dropIndexes/
- ensure
Bool ensure(Str:Obj key, Bool? unique := null, Str:Obj options := ([Str:Obj])[:])Ensures this index exists. If the index does not exist, it is created. If it exists but with a different key / options, it is dropped and re-created.
uniqueif not specified, defaults tofalse.Returns
trueif the index was (re)-created,falseif nothing changed.- exists
Bool exists()Returns
trueif this index exists.- info
Returns index info.
@see http://docs.mongodb.org/manual/reference/method/db.collection.getIndexes/
- make
new make(ConnectionManager conMgr, Str collectionQname, Str indexName, |This? f := null)Creates an
Indexwith the given details.- name
const Str nameThe name of this index.