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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Firestore 安全規(guī)則無(wú)法檢索 request.auth.token.name

Firestore 安全規(guī)則無(wú)法檢索 request.auth.token.name

胡子哥哥 2021-08-20 14:32:29
你誤解了.indexOf()。indexOf返回可以在數(shù)組中找到給定元素的第一個(gè)索引,或者-1如果它不存在。inindex的索引也是如此。簡(jiǎn)而言之,您將對(duì)象 ( ) 與數(shù)字 ( ) 進(jìn)行比較。countercounterscounterindex也就是說(shuō),它還取決于您在數(shù)組中搜索對(duì)象的方式。如果嘗試查找與某個(gè)鍵/值結(jié)構(gòu)匹配的對(duì)象,.indexOf由于您提到的原因?qū)⒉黄鹱饔?。正?Gabriele 所指出的,如果使用參考進(jìn)行搜索,它將起作用。如果使用引用不是一種選擇,作為替代,您可以使用.findIndex(), 或.map(),并根據(jù)其屬性之一查找對(duì)象,例如id.const counters = [{id: 1, value: 0}, {id: 2, value: 0}, {id: 3, value: 0}, {id: 4, value: 0}];const findBySameness = {id: 3, value: 0};const findByRef = counters[2];const indexBySameness = counters.indexOf(findBySameness);console.log('Index by sameness: ', indexBySameness); // Do not find the object indexconst indexByRef = counters.indexOf(findByRef);console.log('Index by reference: ', indexByRef); // Found the object index// If a reference to the object is not available you can use the following methods// With .findIndexconst index3 = counters.findIndex(item => item.id === findBySameness.id)console.log('Index: ', index3); // Found the object index// With .mapconst index2 = counters.map(item => item.id).indexOf(findBySameness.id);console.log('Index: ', index2); // Found the object index
查看完整描述

2 回答

?
倚天杖

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超3個(gè)贊

我無(wú)法直接解決這個(gè)問(wèn)題,但我通過(guò)使用 UserID 而不是用戶名進(jìn)行身份驗(yàn)證繞過(guò)了這個(gè)問(wèn)題,如下所示:

request.resource.data.uid == request.auth.token.sub

請(qǐng)注意,您的 HelloCollection 查詢也應(yīng)更改,以便將用戶 ID 與文本一起存儲(chǔ)。


查看完整回答
反對(duì) 回復(fù) 2021-08-20
  • 2 回答
  • 0 關(guān)注
  • 154 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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