book 表
{id:1, name:'水浒传'}
{id:2, name:'西游记'}
{id:3, name:'红楼梦'}
read表
{id:1, book_id:1, username:'杜凡', open_id:'111111111',time:'2023-08-02'}
{id:1, book_id:1, username:'杜凡', open_id:'111111111',time:'2023-07-02'}
{id:2, book_id:1, username:'张飞', open_id:'222222222' time:'2023-08-02'}
{id:3, book_id:3, username:'杜凡', open_id:'111111111' time:'2023-08-01'}
book表:书
read表:阅读过的用户
需求:
请问云开发如何查询book表中不包含杜凡阅读过的数据
建议看文档,了解一下lookup/match
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/aggregate/Aggregate.lookup.html
read表先过滤掉该用户,再lookup