Phalcon aggerate 排序与语言环境
Phalcon aggerate sort with locale
我想根据匈牙利语排序顺序进行排序 - 例如:"aábc..z" 而不是 "abc..zá"。所以我需要将语言环境 /collation 设置为匈牙利语。
我的管道:
[0] => array[1]
(
[$match] => array[1]
(
[$and] => array[2]
(
[0] => array[1]
(
[aktiv] => true (boolean)
)
[1] => array[1]
(
[aktivGondozott] => true (boolean)
)
)
)
)
[1] => array[1]
(
[$project] => array[2]
(
[_id] => 1 (int)
[alapadatok] => array[1]
(
[$arrayElemAt] => array[2]
(
[0] => '$alapadatok' (string)
[1] => 0 (int)
)
)
)
)
[2] => array[1]
(
[$project] => array[3]
(
[_id] => 1 (int)
[teljesNev] => '$alapadatok.szuletesiTeljesNev' (string)
[szuletesiDatum] => '$alapadatok.szuletesiIdo' (string)
)
)
[3] => array[1]
(
[$sort] => array[1]
(
[teljesNev] => 1 (int)
)
)
[4] => array[1]
(
[$skip] => 380 (int)
)
[5] => array[1]
(
[$limit] => 20 (int)
)
如何在 collection::aggregate() 中的 $sort 中将语言环境设置为 'hu'?
谢谢!
在整理文档中设置语言环境并将其作为聚合选项传递。
$m = new MongoClient;
$c = $m->selectDB("db")->selectCollection("col");
$pipeline = some pipeline
$options = array("collation" => array("locale" => "hu"));
$c->aggregate($pipeline, $options);
我想根据匈牙利语排序顺序进行排序 - 例如:"aábc..z" 而不是 "abc..zá"。所以我需要将语言环境 /collation 设置为匈牙利语。
我的管道:
[0] => array[1]
(
[$match] => array[1]
(
[$and] => array[2]
(
[0] => array[1]
(
[aktiv] => true (boolean)
)
[1] => array[1]
(
[aktivGondozott] => true (boolean)
)
)
)
)
[1] => array[1]
(
[$project] => array[2]
(
[_id] => 1 (int)
[alapadatok] => array[1]
(
[$arrayElemAt] => array[2]
(
[0] => '$alapadatok' (string)
[1] => 0 (int)
)
)
)
)
[2] => array[1]
(
[$project] => array[3]
(
[_id] => 1 (int)
[teljesNev] => '$alapadatok.szuletesiTeljesNev' (string)
[szuletesiDatum] => '$alapadatok.szuletesiIdo' (string)
)
)
[3] => array[1]
(
[$sort] => array[1]
(
[teljesNev] => 1 (int)
)
)
[4] => array[1]
(
[$skip] => 380 (int)
)
[5] => array[1]
(
[$limit] => 20 (int)
)
如何在 collection::aggregate() 中的 $sort 中将语言环境设置为 'hu'?
谢谢!
在整理文档中设置语言环境并将其作为聚合选项传递。
$m = new MongoClient;
$c = $m->selectDB("db")->selectCollection("col");
$pipeline = some pipeline
$options = array("collation" => array("locale" => "hu"));
$c->aggregate($pipeline, $options);