Open
Description
Does the library has any builtin function to check for unique field fore firestore profile field? apprantly its not possible to make a document field value unique with firestore.
What is the current behavior?
I am trying to implement a this on signup form submit. I am trying this way, but I am getting firestore is not a function
onformSubmit = () =>{
const db = this.props.firebase.firestore(); //same error with withFirestore and this.props.firestore();
const usersRootRef = db.collection('Users');
const inputUsername = getUsernameFromInput();
const query = usersRootRef.where('username', '==', inputUsername).get();
query.then((snapShot) => {
const matches = snapShot.size();
if(matches > 0) {
// prompt the user to come up with something else
console.log('username already taken');
} else {
// username unique
console.log('username is unique');
}).catch((error) => console.log(error.message));
});
}
What is the expected behavior?
should query the Users collection with where constrains.