-
Notifications
You must be signed in to change notification settings - Fork 928
FR: Firestore OR operator in WHERE query #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For my specific case something more like an citiesRef.in('id', ['P4ZoMnrNRQjnMGmuMmvc', 'VSw2KyP1YaBRnkheq5kB', 'i1658JL5a2Itv2l0BC8B']) |
OR and IN / CONTAINS / LIKE are pretty basic concepts in query languages. Confused why they are missing here. |
Thanks for the feedback! These query improvements (OR, IN / CONTAINS, and LIKE queries) are all on our radar for future Cloud Firestore query improvements. I'm closing this issue as it's not specific to the JS SDK, but we know that these features would be very useful and there's a lot of demand for them. We intend to address them in the future as we continue to evolve Firestore's query functionality. Thanks! |
I would be very interested in these as well. |
Any news about it? |
I am looking forward to this feature |
Any news on ORing two filters ? |
I'd kill for a |
This would be a great feature to have! |
I am looking forward to this feature too ! |
Same here, I am looking forward to this feature. |
can't wait to see the LIKE query addition |
For anyone struggling for a solution, I mirrored the parts of firestore database relevant to search in elasticsearch. It's a search engine for no-sql database data, and can do WAY more than a "LIKE" or "WHERE" clause in a sql query. It's very customizable. Any additional data needed from the search results can then be pulled from firestore. In my app, elasticsearch handles any search queries, and data is pulled from firestore. You can setup a stack on GCP relatively easily and for free, and now elasticsearch has their own stack deployment option (which can also use GCP, and provides more security options). |
I am looking forward to this feature too ! |
second all this.. OR is very necessary. Trying to concat lists after two WHERE queries is not great. |
Can't wait for this feature! |
This feature would be very helpful. |
any ETA on this ? |
We can't provide ETAs on upcoming features, but as I said before, OR queries and IN queries are definitely on our radar and we appreciate all the interest. For what it's worth, IN queries are likely more straightforward and so we may tackle them first, something along the lines of what @EpicButterz described in #321 (comment). I'd be curious to hear how many of you would find that useful or if you're looking for more general-purpose OR queries. And if you're looking for more general-purpose OR queries, some details on your use cases (e.g. examples of specific queries that you'd want to do in your app) could help us design the feature. Thanks! |
@mikelehen |
Thanks. I'm curious if there's a strong desire for "NOT IN" (against a list of values) or if just "!=" (against a single value) would be sufficient for the use cases you have in mind. |
@mikelehen Let's say I have a list of keys for ignored items. I'd like to be able to easily grab all items where the key is |
i want a datastore like this:
but because there's no IN query, I've to duplicate the relationship:
my requirement is that: |
@antonybudianto Thanks for the feedback. If I'm understanding correctly, I'd actually characterize this as a slightly different feature and the good news is that:
|
Thanks for the solution. But one more, suppose I visit the team "A" page, and want to display its members there (I want to display their names/other fields, not ids), how do you query it (userCollections should contains no relationship object because teamcollections already have it)? |
@antonybudianto Ahh, yeah. To get a member's name, etc. you'd need to look that up from the members collection presumably. Cloud Firestore doesn't support JOIN operations and that's unlikely to change in the foreseeable future. That said, if we added an IN query as described in #321 (comment) then you could look up all the members with a single additional query once you have their IDs. Thanks for the feedback. |
@mikelehen yes, IN operation will be sufficient for my case, thanks for the consideration. |
+1 |
@mikelehen What I really need is the "IN" case. The "OR" case is manageable just by doing two queries and handling it on the frontend. But "IN" is really needed for eager loading. If I am querying a collection and for each of those collections, I need to do separate queries (e.g. to get authors for each post), that opens up tons of connections. Having an "IN" query would enable that to be done with just two queries. |
+1 so essential |
Using "add reaction" on the initial comment would increase priority
while +1 comments
are rather pointless and cause lots of people to get notified for no reason.
To get notified yourself use the [Subscribe] button to the top right
instead.
…On Sat, 23 Feb 2019 at 03:03, timscullin ***@***.***> wrote:
+1 so essential
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#321 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AI2nVkS057uP0Yo13I6tnGhVUoMYgyBjks5vQJNMgaJpZM4QgzlT>
.
|
+1 essential |
+1, we need it |
could people please stop commenting on this and just add a Reaction instead?!?! if you want this feature just add a 👍 on this comment and stop adding useless comments |
YES! Let's commit to terrorizing Firebase with our request for these features! Everyone like this post with a THUMBS UP and contact firebase directly!!! |
+1 |
The fact that this issue has 135 comments plus all the reactions and Firestore team hasn't done anything about it's alarming. |
@devpato True. +1 anyway |
this feature is truely needed |
come on, just copy the MONGO "Find" syntax... |
Decided to open the exact same issue since they closed this one and haven't seen any reply from firebase latetly #1624 |
Hey all, Backend features should be filed at Cloud Firestore's public issue trackers. I took the liberty of filing two features based on this GitHub issue: It'd be great if you could hit the star button if you're interested in one or both features. Additionally if you have a specific usecase that you think would be useful for Google to keep in mind when building this feature please put it there. You can also CC yourself there to get updates from the team - as @mikelehen already has pointed out, this GitHub issue tracker is for the JS SDK, and this feature needs support in the backend. I'd encourage you to file other new feature requests that are backend specific in that issue tracker too! |
Where is the Me too! button? I went to the link for the IN operator and
don't see anything.
…On Thu, Mar 21, 2019 at 3:01 PM Tyler Rockwood ***@***.***> wrote:
Hey all,
Backend features should be filed at Cloud Firestore's public issue
trackers <https://cloud.google.com/support/docs/issue-trackers>.
I took the liberty of filing two features based on this GitHub issue:
- One for the IN operator within filters
<https://issuetracker.google.com/issues/129056739>
- One for the OR operator within filters
<https://issuetracker.google.com/issues/129070817>
It'd be great if you could hit the Me too! button if you're interested in
one or both features. Additionally if you have a specific usecase that you
think would be useful for Google to keep in mind when building this feature
please put it there. You can also CC yourself there to get updates from the
team - as @mikelehen <https://github.com/mikelehen> already has pointed
out, this GitHub issue tracker is for the JS SDK, and this feature needs
support in the backend. I'd encourage you to file other new feature
requests that are *backend specific* in that issue tracker too!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#321 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0raSQm4AyngJRLZyKfhORxhyK9NP_Bks5vZAEtgaJpZM4QgzlT>
.
--
David Lee
Website: tech4good.soe.ucsc.edu
Cell: (408) 857-1182
|
I humbly request all 81 participants of this thread (+158 persons who upvoted) to ⭐️ these issues, so that they can finally start looking into this! |
Just starred it. Everyone take a minute to do the same please! |
Anyone reading this, please go to the following links and click on the STAR icon at the left of the title: |
+1 (sub for news and in the issue tracker too) |
Thank you for raising the issue @darren-dev, starred and commented! |
Have raised another separate issue for NOT IN clause here - https://issuetracker.google.com/issues/129805446. Please star if this is blocking you too |
@jamesreilly5 I may have a possible idea of a draft-fix, if you're open to entertaining the idea while your issue is there... Basically, store the Then you can easily do a
It's not perfect, but it's something :) |
@darren-dev yes ideally this would work but my number of posts per day is not that many so the newer posts would be quickly exhausted. My total number of posts if high (enough) though so if I can keep them random enough it'll work. I'll either take the hit of querying again when duplicates are fetched or think about how I can better distribute my randomness (currently a value between 1 and 1,000,000). I have some ideas in mind. Thanks for the suggestion |
Firestore devs: "Let's pretend this request doesn't exist" |
We're quite aware that this request exists, and are actively working on making this happen. Unfortunately, nearly all the work to support this on the backend where it's invisible. We'll update here when we have something to share. |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Rather than having to make several separate queries I would like to see an OR operator for the WHERE query in Firestore. This is something that is currently available in MongoDB or with the $or operator here.
Relevant Code:
The query could look something like this:
or better yet
The text was updated successfully, but these errors were encountered: