Skip to main content

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
NAMETYPEDESCRIPTION
fieldNamesstring[]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
NAMETYPEDESCRIPTION
fieldNamesjava.util.ListThe 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
NAMETYPEDESCRIPTION
indexorg.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
NAMETYPEDESCRIPTION
indexesjava.util.ListThe 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
NAMETYPEDESCRIPTION
fieldNamesstring[]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
NAMETYPEDESCRIPTION
fieldNamesjava.util.ListThe list of field names.
Return

( org.bson.conversions.Bson )

The index specification.