React Native Firebase to access Firestore database
Database The field selectedJobTypesArr is an array of numbers. The elements are numbers because they come direct from a picklist
Operation . I have a function that uses array-contains-any to match any value in selectedJobTypesArr
export const hasMatchingJobType = (user_id, jobTypeCodeArr) => {
return new Promise((resolve, reject) => {
let foundFlag = false;
firestore()
.collection('profiles')
.where('user_id', '==', user_id)
.where('selectedJobTypesArr', 'array-contains-any', jobTypeCodeArr)
.orderBy('preferredName')
.get()
.then((value) => {
value.docs.map((doc) => {
foundFlag = true;
});
resolve(foundFlag);
});
});
};
To test it I call it as follows:
const user_id = 'TUJawBQN9ge9qNl1l5Qi320UZXK2';
const jobTypeCodeArr = [101, 102, 103, 104, 105];
hasMatchingJobType(user_id, jobTypeCodeArr).then((res) => {
console.log('res ', res);
});
Expected Behaviour returns true when called with matching data
Actual Behaviour Returns false on IOS. If the database array elements are numbers, the array-contains-any only returns expected results with Android not IOS. If I change the database elements to string, both android and IOS produce expected results.
Environment React Native Firebase to access Firestore database version @react-native-firebase/[email protected]
Android build.gradle:
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
}
IOS: podfile containing directive $FirebaseSDKVersion = '8.0.0'
