n6g7 / redux-saga-firebase

A redux saga integration for firebase.
https://redux-saga-firebase.js.org/
MIT License
284 stars 57 forks source link

How to get .where working? #427

Open sidzan opened 5 years ago

sidzan commented 5 years ago

I am having trouble getting .where () query to work using this library.

I tried doing the following in my saga

const documents: firebase.firestore.Query = db.collection("users").where("userId", "==", "gLRK62fqIue0iP23jki9wVTkcqo8")
const snapshot = yield call(rsf.firestore.getDocument, documents);

And it seems to work, however, documents on yield show warning as

Argument of type 'Query' is not assignable to parameter of type 'Base<DocumentReference>

Type 'Query' is missing the following properties from type 'DocumentReference': id, parent, path, collection, and 3 more.

Is this the correct approach? Any suggestion or hint is much appreciated :)

Here is the stackoverflow link too

sidzan commented 5 years ago

@n6g7 any suggestions on this would be great !

Aadmaa commented 4 years ago

// First get the collection reference using the firebase libraries: const colRef = firebase.firestore().collection("users")

// Then you can do like, const snapshot = yield call(rsf.firestore.getCollection, colRef.where("userId", "==", "gLRK62fqIue0iP23jki9wVTkcqo8"))