如何从集合中找到用户定义的列,而不将其放在mongodb查询中的组中?
我想将以下SQL查询转换为mongo:
SELECT
brand_name,
count(`qty/inventory`) AS totalstock,
count(if(`qty/inventory`=0, `qty/inventory`, NULL)) as outofstock,
count(if(`qty/inventory`!=0, `qty/inventory`, NULL)) as availablestock,
DATE_ADD(stock_updated_at, INTERVAL 318 minute) as stock_updated_at
FROM tbl_kunuzdatafeed_master
GROUP BY brand_name
ORDER BY stock_updated_at desc;
任何人都可以帮忙将其转换为mongo查询吗?