Skip to content Skip to sidebar Skip to footer

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

Solution 1:

Make sure this.state.user.email exists before you call this statement.

Solution 2:

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><Linkto={`/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>
                        )}

Solution 3:

// Create a query against the collection. var query = citiesRef.where("state", "==", "CA");

Make sure email is not null or empty

Post a Comment for "Firebaseerror: Function Query.where() Requires A Valid Third Argument, But It Was Undefined"