Node.js Mongoose更新仅更新第一个文档

Node.js Mongoose更新仅更新第一个文档,node.js,mongoose,Node.js,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 #{er

好的。。这很奇怪也很烦人,所以任何帮助都将不胜感激。这是我的密码:

        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}"
没有错,娜达。但由于某种原因,只有第一个文档得到更新。当我在同一个查询上运行find时,会得到多个结果


任何帮助都将不胜感激。

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}"

非常感谢你!我在Mongoose的文档中找不到这一点,尽管我觉得很难相信他们会忽略如此重要的切换。