MongoIndexes
Definition of the index keys in Bson that are used in MongoDB index operations.
ascending
ascending(fieldNames: string[]) : org.bson.conversions.Bson
Description
Creates an ascending index specification for the given fields.
How To Use
collection.createIndex(_mongo.indexes().ascending('quantity', 'price'));
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fieldNames | string[] | The field names. |
Return
( org.bson.conversions.Bson )
The index specification.
ascending(fieldNames: java.util.List<string>) : org.bson.conversions.Bson
Description
Creates an ascending index specification from a list of field names.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fieldNames | java.util.List | The list of field names. |
Return
( org.bson.conversions.Bson )
The index specification.
compoundIndex
compoundIndex(index: org.bson.conversions.Bson[]) : org.bson.conversions.Bson
Description
Create a compound index specifications. If any field names are repeated, the last one takes precedence.
How To Use
collection.createIndex(_mongo.indexes().compoundIndex(
_mongo.indexes().descending('price'),
_mongo.indexes().ascending('quantity')
));
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| index | org.bson.conversions.Bson[] | The index specifications. |
Return
( org.bson.conversions.Bson )
The compound index specifications.
compoundIndex(indexes: java.util.List<?>) : org.bson.conversions.Bson
Description
Create a compound index specifications from a list.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| indexes | java.util.List | The list of index specifications. |
Return
( org.bson.conversions.Bson )
The compound index specifications.
descending
descending(fieldNames: string[]) : org.bson.conversions.Bson
Description
Creates a descending index specification for the given fields.
How To Use
collection.createIndex(_mongo.indexes().descending('price'));
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fieldNames | string[] | The field names. |
Return
( org.bson.conversions.Bson )
The index specification.
descending(fieldNames: java.util.List<string>) : org.bson.conversions.Bson
Description
Creates a descending index specification from a list of field names.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fieldNames | java.util.List | The list of field names. |
Return
( org.bson.conversions.Bson )
The index specification.