Database
[{type:"Graph",name:"Graph A",graph:{nodes:[{id:1},{id:2},{id:3}],edges:[{id:4,type:"A",start:1,end:3},{id:5,type:"A",start:2,end:3}]}},{type:"Graph",name:"Graph B",graph:{nodes:[{id:1},{id:2},{id:3},{id:4}],edges:[{id:5,type:"A",start:1,end:3},{id:6,type:"B",start:2,end:3},{id:7,type:"A",start:2,end:4},{id:8,start:2,end:3},{id:9,start:2,end:3}]}}]
Query
db.collection.aggregate([{$match:{type:"Graph"}},{$set:{allTypeEnds:{$map:{input:"$graph.edges",in:{$concat:["$$this.type","|",{$toString:"$$this.end"}]}}}}},{$set:{allTypeEnds:{$filter:{input:"$allTypeEnds",cond:"$$this"}}}},{$match:{$expr:{$ne:[{$size:"$allTypeEnds"},{$size:{$setIntersection:["$allTypeEnds","$allTypeEnds"]}}]}}},{/** uncomment in actual usage*$unset: "allTypeEnds"*/}])