我有两个要运行的mongo查找查询,然后仅获取同时出现在两个查询中的结果。查询都在同一个集合上完成,但包含不同的信息
查询1:
Db.events.find({event:"Start","Team" : "Blue"},
{eventID:1,Team:1,Target:“ Blue Box”,_ id:0})
查询2:
Db.events.find({event:"End","Team" : "Blue"},
{eventID:1,Team:1,Points:1,_id:0})
理想情况下,我希望同时运行两者并得出类似如下的结果
{eventID: 123,
团队:“蓝色”, 目标:“蓝框”, 点:5}
该集合看起来像这样:
{event:"Start",eventID:1,Team:"Blue",Timestamp:"2018-09-02T13:01:51Z",Target:"Blue Box"}
{event:"Start",eventID:2,Team:"Green",Timestamp:"2018-09-02T13:05:00Z",Target:"Brown Box"}
{event:"Start",eventID:3,Team:"Yellow",Timestamp:"2018-09-02T13:01:51Z",Target:"Red Box"}
{event:"End",eventID:1,Team:"Blue",Timestamp:"2018-09-06T13:01:51Z",Points:5}
{event:"End",eventID:2,Team:"Green",Timestamp:"2018-09-07T13:01:51Z",Points:6}
{event:"End",eventID:3,Team:"Yellow",Timestamp:"2018-09-08T13:01:51Z",Points:4}