问题描述
让我说一个这样的模式:
const Product = mongoose.schema({
product_id: uuid,product_quantity: number,})
const Customer = mongoose.schema({
customer_id: uuid,customer_cart: [product],})
const Store = mongoose.schema({
store_id: string,customers: [customer],})
如果我具有store_id,customer_id和product_id,如何查询产品? 我知道我可以通过取回所有存储文档并使用循环遍历对象数组来查询它。 但是我认为,如果商店有很多顾客并且顾客的购物车中有很多产品,那将会非常慢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)