react-native-firebase
react-native-firebase copied to clipboard
[📚] Documentation Issue - FilterFunction
Documentation Feedback
Where can I find Filter instance to do multiple filter? I cant import it from anywhere.
https://rnfirebase.io/firestore/usage
I want to create something like this:
const snapshot = await firestore() .collection('Users') .where(Filter.and(Filter('user', '==', 'Tim'), Filter('email', '==', '[email protected]'))) .get();
#7124
@pafry7 Is this problem still in progress?
i hope that they will fix this
I'm waiting too.
@pafry7 Is this problem still in progress?
We are waiting for the reviewer
Really sorry for the delay!
Thank you so much @falleco for proposing PR #7124 to fix it and @pafry7 for the review!
It looks good to me and I am inclined to merge it but I will wait for a couple hours in the hope someone else here has a moment to glance over the final changes made in the last few hours to make sure they all look good?
@mikehardy I've patched my project with the changes from PR and no problems so far.
Excellent - thanks again @pafry7 for the quality help - will merge that PR then, I'm queueing it with a batch of PRs that will all release today. Cheers!
Anybody else still having problems? When I import Filter and try to use 'and' or 'or' functions, I get "TypeError: undefined is not a function" errors
Where do you import Filter from? has anyone got a simple example? Thanks
Where do you import Filter from? has anyone got a simple example? Thanks
I import from @react-native-firebase/firestore, but yeah, I still can't really use it
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
I'm still getting struggle after updated from 17.5.0 to 18.3.0 using like this
import firestore, { Filter } from '@react-native-firebase/firestore';
...
.collection(fbPinnedList)
.where(Filter('location.longitude', '<=', longitude + searchSize))
or
.collection(fbPinnedList)
.where(
Filter.and(
Filter('location.longitude', '<=', longitude + searchSize),
Filter('location.longitude', '>=', longitude - searchSize)
)
)
And I think problem is Filter is detected as undefined. Because I can get bellow logs
TypeError: undefined is not a function
or
TypeError: Cannot read property 'and' of undefined
Can I get any hint?
I'm also getting the same problem. I've upgraded the version to 18.3.0, and the Filter is now exported, but it's undefined. Another thing that I also have noticed, is that the types don't look right, I'm getting Filter: any
trying to use Filter.or and getting a similar error TypeError: Cannot read property 'or' of undefined 🫤
I've got to solve the problem. I created a patch to fix the issue.
It's happening because the Filter is not exported. I just exported the Filter from the index.js. I'll try to open a PR to fix it. Not sure if I can do it today though.
Having the same problem here, Filter does not work and shows an error.
Having the same problem here, Filter does not work and shows an error.
I'm trying to use filter.or and I get the same error. Did you find a solution?
@danielkv sir, i tried exporting the filter from the index.js file but that also did not work. Can you please help with a patch log.
If anyone is still struggling with this, the following example might help. It worked for me
import firestore from "@react-native-firebase/firestore";
const snapshot = await firestore()
.collection<Connection>("connections")
.where(
firestore.Filter.or(
firestore.Filter("sender", "==", user.email),
firestore.Filter("receiver", "==", user.email)
)
)
.get();
@shrads12 haven't worked for me.
@danielkv sir, i tried exporting the filter from the index.js file but that also did not work. Can you please help with a patch log.
@mahesh-agrawal-313 I'm sorry for the delay. This is the patch that I've created (I'm using yarn v3+):
@react-native-firebase-firestore-npm-18.3.0-0a6be6db66.patch
diff --git a/lib/index.d.ts b/lib/index.d.ts
index 74872beb39b215c95b3ae89691d19c60a7991491..536be01e02452f1a39947ed9838cd1d30698d91e 100644
--- a/lib/index.d.ts
+++ b/lib/index.d.ts
@@ -2340,7 +2340,7 @@ export const firebase: ReactNativeFirebase.Module & {
): ReactNativeFirebase.FirebaseApp & { firestore(): FirebaseFirestoreTypes.Module };
};
-export const Filter: FilterFunction;
+export const Filter: FirebaseFirestoreTypes.FilterFunction;
export default defaultExport;
diff --git a/lib/index.js b/lib/index.js
index 7b7e8167ff80bf77fdc879992038208f85c9de8e..e784737d688a121ce6f3ca3713d90a38f9d4c355 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -376,3 +376,5 @@ export default createModuleNamespace({
// firestore().X(...);
// firebase.firestore().X(...);
export const firebase = getFirebaseRoot();
+
+export { Filter } from './FirestoreFilter'
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Still relevant
still an issue, but doing firestore.Filter works
If someone posts a PR we can merge it + release 🙏
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Still an issue
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Still relevant
If someone posts a PR we can merge it + release 🙏