-
Notifications
You must be signed in to change notification settings - Fork 2.2k
CollectionReference.doc function path should be optional #1974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I agree, this should align with the Firebase SDK. A potential workaround is to use a pattern like this:
|
+1 Is this going to be fixed in future releases? |
Ran into this earlier as well, had to pass a randomly generated string using date constructors to force creation in the database as a workaround, but was totally caught off guard by this error thrown since it contradicts the docs. |
+1 |
I am getting this error as well, when trying to delete a document, however, it is working in another place in the app, so I am extra confused. |
If you’re getting this error when trying to delete, I think you might be sending an undefined id. |
ah yes you were right! Thank you! Because of the type and positioning of the component I needed to access the id differently |
undefined id. doc['.key'] wasn't working for me any longer had to go doc.id |
What if one does this: |
Mhh, just updated to @angular/fire 5.2 and firebase 6.2.1, and the problem is still here for me. I'm getting the following error:
when trying to set a batch write operation calling "set", with The solution given here works for me... But calling an empty doc on a collection works well with the firebase-admin SDK to create new documents (in case of a batch write using "set"for example), I was expecting the same with the JS client.... |
Here is the bug (line 5) :
Workaround :
|
It is working for me:
|
Version info
Angular: 7.1.2
Firebase: 5.6.0
AngularFire: 5.1.1
Other (e.g. Ionic/Cordova, Node, browser, operating system):
How to reproduce these conditions
Steps to set up and reproduce
Example code:
Failing on the following error:
But should be valid per firebase documentation and source:
Add doc example https://firebase.google.com/docs/firestore/manage-data/add-data
Source definition of doc function https://github.com/firebase/firebase-js-sdk/blob/master/packages/firebase/index.d.ts#L1951
Debug output
** Errors in the JavaScript console **
Expected behavior
Doc reference should be created per firebase documentation
Actual behavior
Invalid argument error thrown
Fix
path argument should be optional in https://github.com/angular/angularfire2/blob/master/src/firestore/collection/collection.ts#L141
The text was updated successfully, but these errors were encountered: