第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在mongodb更新中使用變量

在mongodb更新中使用變量

暮色呼如 2019-12-08 12:08:42
我正在使用Meteor進行如下更新:Items.update(Session.get('selectedItem'), {'$set': {'directions.0.name': area.value}})但是我在努力如何動態(tài)設(shè)置方向的數(shù)組索引,就像這樣:var index = //a value determined dynamicallyItems.update(Session.get('selectedItem'), {'$set': {'directions[index]name': area.value}})這不起作用,因為[index]被包裝在字符串中。我還嘗試形成一個自定義字符串,如下所示:var string = 'directions.'+itemIndex+'.name'Items.update(Session.get('selectedItem'), {'$set': {string: area.value}})但這是行不通的。關(guān)于如何執(zhí)行此操作的任何想法?
查看完整描述

1 回答

?
繁花如伊

TA貢獻2012條經(jīng)驗 獲得超12個贊

我正在使用Meteor進行如下更新:


Items.update(Session.get('selectedItem'), {'$set': {'directions.0.name': area.value}})

但是我在努力如何動態(tài)設(shè)置方向的數(shù)組索引,就像這樣:


var index = //a value determined dynamically

Items.update(Session.get('selectedItem'), {'$set': {'directions[index]name': area.value}})

這不起作用,因為[index]被包裝在字符串中。我還嘗試形成一個自定義字符串,如下所示:


var string = 'directions.'+itemIndex+'.name'

Items.update(Session.get('selectedItem'), {'$set': {string: area.value}})

但這是行不通的。關(guān)于如何執(zhí)行此操作的任何想法?


查看完整回答
反對 回復(fù) 2019-12-16
  • 1 回答
  • 0 關(guān)注
  • 555 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號