现有数据如下
{
"_id" : ObjectId("5992c90beeb45634df1c2be4"),
"name" : "测试数据1",
"status" : {
"product" : [
{
"id" : ObjectId("59a37f7aef887a1d58b59f4f"),
"sort" : 2
},
{
"id" : ObjectId("59a37f7bef887a1d58b59f50"),
"sort" : 54
},
{
"id" : ObjectId("59a3801cef887a1d58b59f55"),
"sort" : 66
}
],
"line":[]
}
},
{
"_id" : ObjectId("599e7dc07780bbfa9bee42a9"),
"name" : "test数据2",
"status" : {
"product" : [
{
"id" : ObjectId("59a37f7aef887a1d58b59f4f"),
"sort" : 1
},
{
"id" : ObjectId("59a37f7bef887a1d58b59f50"),
"sort" : 30
},
{
"id" : ObjectId("59a3801cef887a1d58b59f55"),
"sort" : 60
}
],
"line":[]
}
}
......
我想要把整个集合按照status.product里的id=ObjectId("59a37f7aef887a1d58b59f4f")的数据对应的sort字段进行倒序排序,查询语句应该怎么写呢?
1 回答
- 1 回答
- 0 关注
- 1343 浏览
添加回答
举报
0/150
提交
取消