MongoSorts
Definition of the sorts in Bson that are used in MongoDB collection queries.
ascending
ascending(fieldNames: string[]) : org.bson.conversions.Bson
Description
Creates an ascending sort for the given fields.
How To Use
collection.find().sort(_mongo.sorts().ascending('name')).all();
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fieldNames | string[] | The field names. |
Return
( org.bson.conversions.Bson )
The sort.
ascending(fieldNames: java.util.List<string>) : org.bson.conversions.Bson
Description
Creates an ascending sort 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 sort.
descending
descending(fieldNames: string[]) : org.bson.conversions.Bson
Description
Creates a descending sort for the given fields.
How To Use
collection.find().sort(_mongo.sorts().descending('date')).all();
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fieldNames | string[] | The field names. |
Return
( org.bson.conversions.Bson )
The sort.
descending(fieldNames: java.util.List<string>) : org.bson.conversions.Bson
Description
Creates a descending sort 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 sort.
orderBy
orderBy(sorts: org.bson.conversions.Bson[]) : org.bson.conversions.Bson
Description
Combines multiple sorts into a single sort.
How To Use
collection.find().sort(_mongo.sorts().orderBy(_mongo.sorts().ascending('name'), _mongo.sorts().descending('date'))).all();
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sorts | org.bson.conversions.Bson[] | The sorts to combine. |
Return
( org.bson.conversions.Bson )
The combined sort.
orderBy(sorts: java.util.List<?>) : org.bson.conversions.Bson
Description
Combines multiple sorts from a list.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sorts | java.util.List | The list of sorts to combine. |
Return
( org.bson.conversions.Bson )
The combined sort.