Firestore: add()
does not support _WithConverterDocumentReference
#6280
Unanswered
idkq
asked this question in
Feature request
Replies: 1 comment 3 replies
-
Do you have some code samples to reproduce the issue? |
Beta Was this translation helpful? Give feedback.
3 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.
Uh oh!
There was an error while loading. Please reload this page.
-
When you
.add()
new Document and your collection was initiated with.withConverter<Dog>()
, you'll get aDocumentReference<Dog>
back as expected. Now, if you want to use this reference to add a new second document that references the first doc, it throws and exception.Why? Because it expects a
_JsonDocumentReference
instead of a_WithConverterDocumentReference
.The solution is to get the document again from Firestore, but this time without the converter, and use the reference to add a new document.
There must be a better way to do this either by accessing _originalDocumentReference or having the
add()
method handling this automatically.Beta Was this translation helpful? Give feedback.
All reactions