ネストされたオブジェクトの値に基づいて結果を並べ替えようとしています。を使用してnode-mongodb-native
、私はこれを行っています:
this.collection.find({
"_id": ObjectID(item_id) },
{ "items": 1 },
{ sort : { items.date : 1 }
}, function(err, result) {
if (err) {
callback(err);
} else {
callback(null, result);
}
});
の予期しないトークンエラーが発生しitems.date
ます。
items
オブジェクトの配列です。空の配列であるドキュメントもあれば、フィールドを含むデータを含むドキュメントもありdate
ます。
ありがとうございました!