Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
54
rated 0 times [  59] [ 5]  / answers: 1 / hits: 6512  / 5 Years ago, mon, march 11, 2019, 12:00:00

this.unsubscribe = this.refAssign.where(‘email’, ‘==’, this.state.user.email ).onSnapshot(this.onCollectionUpdate);




FirebaseError: Function Query.where() requires a valid third argument,
but it was undefined.




I’ve got this message. What I should write for the third argument as I want it to return each one of the User which has the same email as in Assign collection ?


More From » reactjs

 Answers
3

After a numerous try and error, I've found out that it is not possible to do this using where clause



`componentDidMount() {
this.unsubscribe1 = this.ref.onSnapshot(this.onCollectionUpdate1);
this.unsubscribe2 = this.refAssign.where(‘email’, ‘==’, this.state.user.email ).onSnapshot(this.onCollectionUpdate2);
}`


instead of that, I compare it in render using condition ? true : false



                        {this.state.user.map(user =>
<tr>
<td><Link to={`/show/${user.key}`}>{user.email}</Link></td>
<td>{user.name}</td>
<td>{user.authority}</td>
<td>
{this.state.assign.map(assign =>
<p>{assign.email == user.email ? assign.projNo : null }</p>
)}
</td>
</tr>
)}

[#8516] Friday, March 8, 2019, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jimmieo

Total Points: 515
Total Questions: 102
Total Answers: 110

Location: Kazakhstan
Member since Mon, Sep 26, 2022
2 Years ago
;