0

When I watch the certain ids in the collection using MongoDB watch I am getting error

ERROR Error: Uncaught (in promise): e: (TRANSPORT_ERROR): the request transport encountered an error communicating with Stitch: event source failed to open and will not reconnect; check network log for more details e: (TRANSPORT_ERROR): the request transport encountered an error communicating with Stitch: event source failed to open and will not reconnect; check network log for more details

It was working till yesterday it started from today

            const db = mongoClient.db(environment.databaseName);
            const comments = db.collection('collectionName');

            this.changeStream = await comments.watch(ids);
            this.changeStream.onNext((event) => {
                console.log('Watched document changed:', event);
                this.fetchData();

            });

I expect that whenever the document is changed in the list of ids. Change event should trigger.

  • 1
    Also note that in case you're coming from a firebase background(like me), the change event is ONLY triggered when the doc changes, and nothing is emitted until something changes That means if you want to get the data first you need to make an independent query first – Kisinga Aug 25 '19 at 20:01

1 Answers1

1

This indicates that your app is unable to communicate with the stitch backend, probably because of not internet or poor network

Kisinga
  • 1,640
  • 18
  • 27