doc().get() not always returning everything #11669
Replies: 1 comment
-
I figured it out. Were were doing some writes with merge, but there were happening asyncronously, and we weren't awaiting them... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We have some code that does the following:
I have changed the name of the collection and document to match the documentation for this example
When we do this, there is only one element in doc.data, when there is more in the cloud firestore. However, if we do something more like:
Then the first time that the callback is fired, it has pendingWrites and only has the one element. The second time it fires, it has all the data and has no pendingWrites. This leads to my questions:
Why is it when we do just docRef.get() and .data(), do we not have all of the information down from the cloud yet? My second question I thought that pendingWrites was just that it needed to write to the cloud, but that everything should be correct locally. I assuming it is a bad idea to depend on pendingWrites to go to true before I check for the data that I need, but doing just .get() doesn't always return all of the data.
Is there something that I am missing on the .get()? Or why would it not return everything that is on the server? Or is there something I should look for? Or do I just completely misunderstand what .get does?
Thank you in advance for helping me!
Beta Was this translation helpful? Give feedback.
All reactions