云数据库上有个集合:class,数据如下:
[
{
“name”:“一班”,
“students”:[
{
“studentNo”: “101”,
“studentName”: “张一”
}, {
“studentNo”: “102”,
“studentName”: “王一”
}
]
},{
“name”:“二班”,
“students”:[
{
“studentNo”: “201”,
“studentName”: “李二”
}, {
“studentNo”: “202”,
“studentName”: “赵二”
}
]
}
]
我现在有个学号列表,比如[“101”, “202”],我想查询class集合,匹配这个学号列表,查询列表中存在的学生,返回的结果中students里只包含匹配的学生信息,也就是说想得到下面的目标数据,请问这个如何实现?
[
{
“name”:“一班”,
“students”:[
{
“studentNo”: “101”,
“studentName”: “张一”
}
]
},{
“name”:“二班”,
“students”:[
{
“studentNo”: “202”,
“studentName”: “赵二”
}
]
}
]