MongoDB$where查询,字段名中带空格

MongoDB$where查询,字段名中带空格,mongodb,Mongodb,我使用MongoDB发出$where请求,如下所示: db.statistiquesClients.find({$where : function() { return (this.postal code == "123 456")}}) 如您所见,邮政编码字段有一个空格,因此此请求不起作用,错误为: 2018-12-18T21:28:57.254-0500 E QUERY [js] SyntaxError: missing ) in parenthetical @(shell):1:7

我使用MongoDB发出$where请求,如下所示:

db.statistiquesClients.find({$where : function() { return (this.postal code == "123 456")}})
如您所见,邮政编码字段有一个空格,因此此请求不起作用,错误为:

2018-12-18T21:28:57.254-0500 E QUERY    [js] SyntaxError: missing ) in parenthetical @(shell):1:71

我尝试用不占空间的其他表达式替换“邮政编码”,效果很好。

您可能需要将其更改为
此[“邮政编码”]