我想在Collection.find查詢中使用一個變量作爲字段說明,但只是山雀忽略它流星Collection.find使用變量作爲動態蒙戈查詢字段
var qry = "{\"" + field_name + "\":" + field_value + "}"
console.log(qry)// {"customer_active":true}
Customers.find(qry).map(function(customer){// doesn't find anything
console.log(customer)
var groups = customer.customer_group_id.push(a._id)
Customers.update({$set: {customer_group_id: groups}})
})
如何建立一個動態查詢
這並不工作,我得到一個'意外令牌[' – Moshe 2014-12-04 15:09:33
做工精細當我嘗試它。也許你有一個錯字? – JohnnyHK 2014-12-04 15:17:46