Multiple $where queries in MongoDB
问题 I tried to put following query together, but it is not working: db.sss.find({ "pos": { "$gte": 200000, "$lt": 2000000 }, "$where": "(this.chr.letter != "X" && this.chr.no == 5) && (this.chr.letter != "X" && this.chr.no == 6) && (this.chr.letter != this.chr.letter)" }) The above condition above I tried to explain below: chr.no = 5 and chr.no = 6 chr.letter between two objects/dicts in chr are not the same and no X , and the document must be in range 200000 - 2000000 The example output could