1

次のような構造のオブジェクトのコレクションがあります。

{
    "_id" : ObjectId("5233a700bc7b9f31580a9de0"),
    "id" : "3df7ce4cc2586c37607a8266093617da",
    "published_at" : ISODate("2013-09-13T23:59:59Z"),
    ...
    "topic_id" : [
        284,
        9741
    ],
    ...
    "date" : NumberLong("1379116800055")
}

次のクエリを使用しようとしています。

db.collection.find({"topic_id": { $in: [ 9723, 9953, 9558, 9982, 9833, 301, ... 9356, 9990, 9497, 9724] }, "date": { $gte: 1378944001000, $lte: 1378954799000 }, "_id": { $gt: ObjectId('523104ddbc7b9f023700193c') }}).sort({ "_id": 1 }).limit(1000)

上記のクエリはtopic_id, dateインデックスを使用していますが、返された結果の順序は保持されません。

強制的に使うhint({_id:1})と結果は順当になるのですが、指定nscannedしても100万文書です。limit(1000)

私は何が欠けていますか?

4

0 に答える 0