如何从子列表中按字段排序? 我的示例对象如下所示: 产品:
{
"_id" : ObjectId("56388c95d27d5307f4b3deef"),
"Name" : "Build your own computer",
"ProductCategories" : [
{
"_id" : ObjectId("56388c96d27d5307f4b3df01"),
"CategoryId" : NumberInt(2),
"IsFeaturedProduct" : false,
"DisplayOrder" : NumberInt(1),
"Published" : false
},
{
"_id" : ObjectId("56388c96d27d5307f4b3df01"),
"CategoryId" : NumberInt(3),
"IsFeaturedProduct" : false,
"DisplayOrder" : NumberInt(1),
"Published" : false
}
],
}
我需要按字段DisplayOrder对对象产品列表进行排序,但是对于categoryId = 3 这可能吗?
感谢您的帮助!