[Firebase]ドキュメントId取得

ドキュメントId取得

            //testfieldが該当の値のtestcollのドキュメントID取得
            const documentId;
            await firebase.firestore()
            .collection('testcolloya')
            .doc('testdocoya')
            .collection("testcoll")
            .where('testfield', '==', '1234xxxxxxxxxxxxx5678')
            .get()
            .then(snapshot => {
                snapshot.docs.forEach(doc => {
                    documentId = doc.id;
                });
            });

投稿者: kinkun

保有資格 Salesforce Certified Platform App Builder T Salesforce Certified Platform Developer I Salesforce Certified Platform Developer II Salesforce Certified Administrator

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です