值我有以下型號:貓鼬:從型號
var requestSchema = new Schema({
description: { type: String, required: true },
country: { type: String, index: true },
shipping: [shipping],
deliveryLoc: { type: String, index: true },
price: { type: Number, default: 0 },
})
我現在想用貓鼬拿到的價格和我不知道哪個命令我必須使用。
我想:
var pricy = _.first(_.where(request.price));
,它不工作,我得到了一個未定義甚至通過通過其他的查詢在相同的文件,我可以得到「發貨」。
獲取出貨機型而適用於以下命令:
var shipping = _.first(_.where(request.shipping, { type: shippingType }));
我使用了錯誤的命令?
'price'不是一個數組,那麼爲什麼你不直接以'request.price'的形式直接訪問它的值呢? – JohnnyHK