CollectionOrdering mixin。
方法
-
sort ([SortExprStr])
-
设置结果集的顺序选项。
参数:
的名字 类型 论点 描述 SortExprStr
字符串|数组。<字符串> <可选> 要排序的属性(和方向) 返回:
查询实例。例子
//参数作为列(和方向)排序const query = collection.find()。Sort ('foo asc', 'bar desc') //列数组(和方向)排序const query = collection.find()。Sort (['foo asc', 'bar desc'])