Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 爱奥尼亚+;Firestore-bollean字段检索_Angular_Typescript_Firebase_Ionic3_Google Cloud Firestore - Fatal编程技术网

Angular 爱奥尼亚+;Firestore-bollean字段检索

Angular 爱奥尼亚+;Firestore-bollean字段检索,angular,typescript,firebase,ionic3,google-cloud-firestore,Angular,Typescript,Firebase,Ionic3,Google Cloud Firestore,我需要检索文档FIRESTORE的布尔值 有人知道怎么做吗?希望你能试试这个: 使用云Firestore SDK let docRef = db.collection("following").doc("your-id"); docRef.get().then((doc)=> { if (doc.exists) { console.log("Document data:", doc.data()); let myData=doc.data();

我需要检索文档FIRESTORE的布尔值


有人知道怎么做吗?

希望你能试试这个:

使用
云Firestore SDK

let docRef = db.collection("following").doc("your-id");

docRef.get().then((doc)=> {
    if (doc.exists) {
        console.log("Document data:", doc.data());
        let myData=doc.data();
        let isTrue= myData.boolean-property-name;//return true or false
      } else {
        console.log("No such document!");
    }
}).catch(function(error) {
    console.log("Error getting document:", error);
});
使用AngularFire2:

注意:

阅读本文:

您的id
-您需要在此处传递您的
文档


布尔属性名
-这只是一个伪名称。您需要在此处传递实际的属性名称。在您的案例中,它类似于
cug…..
Firestore不支持direct。如果要继续,请使用doc.ref.get()。

您好,非常感谢您的回答。。。我尝试使用指定的代码,但它返回了3个错误,打印在链接中:()我现在进行了更改,只得到1个错误:类型“AngularFirestoreDocument”上不存在Typescript错误属性“get”。您是否使用
angularfire2
?是的,我正在使用
angularfire2
确定。。。我会检查链接上的文档,我相信现在解决问题更容易了。。。你在发送给我的代码上帮了我很多。。。谢谢你的帮助!:)