文件:
{ "group" : "G1", "cat" : "Cat1", "desc": "Some description 1"}
{ "group" : "G1", "cat" : "Cat2", "desc": "Some description 2"}
{ "group" : "G1", "cat" : "Cat1", "desc": "Some description 3"}
{ "group" : "G1", "cat" : "Cat3", "desc": "Some description 4"}
{ "group" : "G1", "cat" : "Cat2", "desc": "Some description 4"}
有人可以帮助我,使用猫鼬,如何找到具有独特group
和的记录cat
?
从 Mongoose API for 中distinct
,我了解到我只能使用一个字段。但是可以Model.distinct
用于根据两个字段查找文档吗?