简体   繁体   English

Firestore控制台更改不会触发snapshotChanges订阅

[英]Firestore console changes does not trigger snapshotChanges subscription

I am trying to subscribe to a document in Firestore by using AngularFire. 我正在尝试使用AngularFire订阅Firestore中的文档。 When I edit my document through Firestore console, I cannot see any difference in the pulled data even after refreshing my local. 当我通过Firestore控制台编辑文档时,即使刷新本地后,在拉出的数据中也看不到任何差异。 DocumentChangeAction.type is still "added" after modification. 修改后,仍将“添加” DocumentChangeAction.type。

Doesn't console changes suppose to trigger "modified" action even for manual updates ? 控制台更改是否假设即使是手动更新也触发“已修改”操作?

Thanks. 谢谢。

retrieveUserPosts666 (uid: string, page, lastKey,now:number, nowBefore30:number) {

        let plizt = [];

        return this.afs.collection<any>("uk", ref => {

            let query : firebase.firestore.CollectionReference | firebase.firestore.Query = ref;

            query = query.where('uid','==',uid);
            query = query.orderBy('postdate','desc');
            query = query.startAt(lastKey).limit(page);

            return query;

        }).snapshotChanges().map(x=> {

            x.forEach((post, index) => {

                plizt.push({
                    "key": post.payload.doc.id,
                    "itm": post.payload.doc.data(),
                    "city" : this.retrieveBeatifulCityName(post.payload.doc.get('city')),
                    "cut_en" : post.payload.doc.get('description_en').substring(0,100) + "..."
                })

            });
            return plizt;
        })

    }

I replaced "AngularFirestoreModule.enablePersistence()" with just "AngularFirestoreModule" in imports section of app.module.ts. 我在app.module.ts的imports部分中仅用“ AngularFirestoreModule”替换了“ AngularFirestoreModule.enablePersistence()”。 Resolved now. 现在解决。 Please refer to following page. 请参考下一页。 ( https://firebase.google.com/docs/firestore/manage-data/enable-offline ) https://firebase.google.com/docs/firestore/manage-data/enable-offline

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular / Firestore-snapshotChanges()将文档打印到控制台5次 - Angular / Firestore - snapshotChanges() Map printing a document to the console 5 times 什么是firestore中的snapshotchanges - What is snapshotchanges in firestore 如何在firestore和ionic 4中使用snapshotChanges() - How to use snapshotChanges() with firestore and ionic 4 Firestore SnapshotChanges - 监听新文档 - Firestore SnapshotChanges - Listening for New Document Angular Firestore 测试:snapshotChanges() 不是 function - Angular Firestore Testing: snapshotChanges() is not a function Angularfire2快照更改订阅管道问题 - Angularfire2 snapshotchanges subscription pipe problem 如何只查询一次 Firestore DB? 我想避免当文档发生更改时,snapshotChanges() 会发出新值 - How can I query Firestore DB only once? I want to avoid that when something changes on a document the snapshotChanges() emit new value 如何在Firestore Angular7中将orderBy与snapshotChanges()结合使用 - How to use orderBy with snapshotChanges() in Firestore Angular7 BehaviorSubject部分更改不会触发订阅 - BehaviorSubject partial change does not trigger subscription 属性“ snapshotChanges”在类型“ void”上不存在。 离子3 - Property 'snapshotChanges' does not exist on type 'void'. ionic 3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM