2017-06-02 97 views
0

我想在节点orm中使用find方法获取排序项目。我知道find()中有'order'参数,它会给我从'a-z'分类的项目。如果我想从'z-a'命令获得项目,我该怎么做这意味着如何在节点orm中使用'GROUP BY DESC'?如何对节点orm中的项目进行排序find

回答

0

有由

UserModel.find({ID:ID_VALUE})为基的方法GROUPBY({列1,列2})的顺序( ' - 名称')。

在ORM库中,你可以找到下面的功能,它会引导你更多。

export interface SelectQuery { 
select(fields: string): SelectQuery; 
calculateFoundRows: SelectQuery; 
as(alias: string): SelectQuery; 
fun(fun: string, column: string, alias: string): SelectQuery; 
from(table: string, from_id: string, to_id: string): SelectQuery; 
from(table: string, from_id: string, to_table: string, to_id: string): SelectQuery; 
where(...args: any[]): SelectQuery; 
whereExists(table: string, table_link: string, link: string, conditions: { [column: string]: any }): SelectQuery; 
groupBy(...columns: string[]): SelectQuery; 
offset(offset: number): SelectQuery; 
limit(limit: number): SelectQuery; 
order(column: string, direction: string): SelectQuery; 
build(): string; 
} 
相关问题