# #react-native #google-cloud-firestore
Вопрос:
это моя цель
readUserIDS:[ 0: ID1 1:ID2 ]
или
readUserIDS:[ 0: ID1 ]
Я хочу отобразить только массив с 1 идентификатором, но я не знаю, как запросить мой массив с помощью firestore. В принципе, я хочу найти только массив.длина с одним идентификатором
const notification = () =gt; { channelsRef .where('channelID', '==', item.id) .get() .then((querySnapshot) =gt; { querySnapshot.forEach((doc) =gt; { doc.ref .collection('thread') .where('senderID', '==', item.participants[0].id) .where('readUserIDs.2', 'gt;', '') .get() .then((querySnapshot) =gt; { console.log('size', querySnapshot.size); querySnapshot.forEach((thread) =gt; { let data = querySnapshot.size; console.log('data', data); }); }); }); }); };
Ответ №1:
const notification = () =gt; { channelsRef .where('channelID', '==', item.id) .get() .then((querySnapshot) =gt; { querySnapshot.forEach((doc) =gt; { doc.ref .collection('thread') .where('senderID', '==', item.participants[0].id) .where('readUserIDs.2', 'gt;', '') .get() .then((querySnapshot) =gt; { return querySnapshot.size; }); }); }); };
Комментарии:
1. @Xwingoga06 Не могли бы вы подтвердить, был ли ответ полезным? если да, то не могли бы вы поддержать или принять ответ? Это действительно поможет сообществу.