复杂的MongoDB查询,除非万不得已,不然不要用 $where
{ "$or" : { "first_name": "Dany" , "last_name": "Fang" },{ "first_name": "Amber " , "last_name": "Wei" } }
<=> 等價于
"$where": "function() { \
var key = {'Dany Fang':1,'Amber Wei:1}; \
var id = this.first_name+' '+ this.last_name;
return key[id] ? true : false; \
}"