mongoose更新只更新第一个文件

好吧..这是奇怪的,烦人的,所以任何帮助将非常感激。 这是我的代码:

Target.update {location_city: "New York"}, {location_country: "FUDGE!"}, {safe: true}, (err, res) -> console.log "Updating with New York" console.log res console.log "Err #{err}" 

没错,NADA。 但是只有FIRST文件由于某种原因而被更新。 当我在SAME查询上运行查找时,我得到了多个结果。

任何帮助将非常感激。

multi必须是true

所以正确的查询将是

  Target.update {location_city: "New York"}, {location_country: "FUDGE!"}, {multi: true}, (err, res) -> console.log "Updating with New York" console.log res console.log "Err #{err}"