Open johanchouquet opened 2 years ago
This issue does not seem to follow the issue template. Make sure you provide all the required information.
Spitballing here, does this work?
return doc(this.firestore, 'some-collection', 'newdoc').id
Thanks @mattgibb. I didn't try that. But I found a solution:
const docRef = doc<T>(colRef) as DocumentReference<T>;
return docRef.id;
Hope it can help others who struggle with the upgrade.
@johanchouquet I'm wondering, for your solution, what is colRef? thanks!
Hi everyone,
I'm not sure this is a bug, but rather, it might bring to light a potential breaking change. Anyway, I'd be happy to be in the wrong concerning my issue. I also tried to search for this in Stackoverflow but I couldn't find anything related to my problem.
I upgraded one of my applications to AngularFire v7 (latest), not using the compat layer, but directly the new API approach. In the end, it seems to be easier to use and closer to the firebase API, and the use of RxFire seems quite straightforward.
In the process, I managed to rewrite all my API calls etc... Except for one thing: I didn't find a replacement method for the old
createId()
method that exists on v6.1.5, which is still present in the compat layer:createId() I paste the code here also so it's easier to read:
I tried to implement it the same way in v7:
But this method is too naïve, and triggers some error:
Version info
Angular: 12
Firebase: 9
AngularFire: 7.1
Expected behavior
The actual new API should provide a way to do the same functionality as v6.1.5. Maybe there's a way to do it but I couldn't find out what it is. If the API has no such functionality, it should be in the documentation somewhere, but again, I couldn' t find where.
Actual behavior
The createId() method seems not reproduced with the new v7 API.