Open dsgriffin opened 3 years ago
Did you see this? https://github.com/prescottprue/redux-firestore/issues/176
Did you see this? prescottprue/redux-firestore#176
yep, I've been using where: ['__name__', '==', ...]
as it's the only working solution currently, but a bit of a hack.
Not sure why the statics wouldn't be available on the instance returned from useFirestore, but you should be able to be pull straight from the firebase SDK (since it is just a static):
import firebase from 'firebase/app'
import 'firebase/firestore'
// Then later
firebase.firestore.FieldPath.documentId()
@dsgriffin Thanks for sharing the workaround, that is also valid!
@prescottprue no worries!
just tried using firebase.firestore.FieldPath.documentId()
inside useFirestoreConnect
's where
clause.
discovered that type WhereOptions
expects a string
as the first argument, while documentId()
returns a FieldPath
. using a toString()
on it might be a solution
it works for me....
import firebase from firebase/firestore
const collectionRef = collection(db, 'myData'); const q = query(collectionRef, where(firebase.documentId(), 'in', ['a', 'b']));
Do you want to request a feature or report a bug?
Bug
(If this is a usage question, please do not post it here—post it on gitter. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)
What is the current behavior?
FieldPath
does not exist onFieldPath
when retrieving via theuseFirestore
hook.What is the expected behavior?
Trying to retrieve multiple documents in one go via
in
insideuseFirestoreConnect
e.g. this should work:But the only property that exists on
FieldPath
currently isisEqualTo
.If I try to use
firebase
directly e.g.I get a ton of type issues and cannot proceed.
Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?
Latest Stable (3.10.0)