AI助手支持GPT4.0
云数据库的查询语法能做到这样吗?Can the query syntax of cloud database do this?
云数据库的查询语法能做到这样吗?
有以下两条数据,先根据 groupName 查询到某一条数据,再根据 name 查询该条数据内 list 字段,比如最终返回 {"name": "lisi", "age": 18}
{ "groupName": "g1", "total": 1, "list": [ {"name": "wangwu", "age": 19} ]}{ "groupName": "g2", "total": 2, "list": [ {"name": "zhangsan", "age": 20}, {"name": "lisi", "age": 18} ]}
There are two pieces of data. First query a piece of data according to groupname, and then query the list field in the piece of data according to name, For example, {"name": "Lisi", "age": 18} {"groupname": "G1", "total": 1, "list": [{"name": "Wangwu", "age": 19}]} {"groupname": "G2", "total": 2, "list": [{"name": "Zhangsan", "age": 20}, {"name": "Lisi", "age": 18}]}
.where({groupName:'g2',"list.name":'lisi'})这个能返回带lisi的整条记录,然后你再js过滤吧。否则只能aggregate了。