MongoDBシェルを使用していくつかの結果を取得しています。ここでサンプラーだ、私が手に入れたいものを配列フィールドでサブ文書を並べ替える方法は?
{
"_id" : "32022",
"topics" : [
{
"weight" : 281.58551703724993,
"words" : "some words"
},
{
"weight" : 286.6695125796183,
"words" : "some more words"
},
{
"weight" : 289.8354232846977,
"words" : "wowz even more wordz"
},
{
"weight" : 305.70093587160807,
"words" : "WORDZ"
}]
}
は、同じ構造であるが、私はいくつか注文した結果を得ることができませんが、idフィールドによってそれらをグループ化するには運"topics" : []
{
"_id" : "32022",
"topics" : [
{
"weight" : 305.70093587160807,
"words" : "WORDZ"
},
{
"weight" : 289.8354232846977,
"words" : "wowz even more wordz"
},
{
"weight" : 286.6695125796183,
"words" : "some more words"
},
{
"weight" : 281.58551703724993,
"words" : "some words"
},
]
}
によって命じました。これを行う方法はありますか?
あなたは私たちのサンプルドキュメントを表示する必要がありますあなたが得たものだけでなく、期待される結果。 – styvane
@ user3100115更新された質問を確認する –