如何testingmongodb标准对象中两个外部值是否相等?

鉴于集合:

{id: 1, name:"abc"}, {id: 2, name:null} 

testing我使用的属性:

 db.collecton.find({name:"abc"}, {name:1}); // which returns the first document. 

我还想为这样的两个外部值添加一个testing:

 value1 = 100; value2 = 100; // value2 might be different than value1 db.collecton.find({name:"abc", $eq:[ value1, value2 ]}, {name:1}); 

这导致没有发现。 我不想添加value1或value2作为属性,我只是想确保他们匹配除了其他标准。 另外,我意识到我只能运行查询如果两个外部值匹配,但如何将这些外部variables添加到标准?

 db.collection.find({ name : 'abc', name : { $type : 1 + (value1 === value2) }})