[英]mongodb: find all records by condition in other documents
Not sure how to formulate the task correctly in words.不确定如何正确地用文字表述任务。
Say there are such documents in a collection:假设集合中有这样的文档:
{id:1, type: 'added' },
{id:1, type: 'completed' },
{id:2, type: 'added' },
{id:3, type: 'added' },
Find all documents with type added
for which doesn't exist records with the same id
and completed
查找所有
added
类型的文档,但不存在具有相同id
和completed
So it would find only:所以它只会找到:
{id:2, type: 'added' },
{id:3, type: 'added' },
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.