我想使订购基于匈牙利排序 - 例如:“aábc..z”而不是“abc..zá”。所以我需要将语言环境/校对设置为匈牙利语。
我的管道:
[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)
)
如何在集合:: aggregate()中的$ sort中将语言环境设置为'hu'?
谢谢!
答案 0 :(得分:0)
在排序规则文档中设置区域设置,并将其作为聚合选项传递。
$m = new MongoClient;
$c = $m->selectDB("db")->selectCollection("col");
$pipeline = some pipeline
$options = array("collation" => array("locale" => "hu"));
$c->aggregate($pipeline, $options);