Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これら2つは同じであることが保証されていますか:
collection.limit(10).sort("{score: -1}")
対
collection.sort("{score: -1}").limit(10)
2 番目のものはグローバルな並べ替えを行い、上位 10 件を返します。
ありがとう
通常のクエリでは、カーソル オブジェクトに追加する順序に関係なく、sortが最初に処理され、次に が処理され、次に が処理されます。skiplimit
sort
skip
limit
集約フレームワークは、パイプラインに出現する順序で$sort、$skipおよび演算子を実行します。limit
$sort
$skip