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

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 ?

Answer

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>
                        )}