Skip to content
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

Query With Custom Sorting, Occurrences In String Array #1586

Open
ljs19923 opened this issue Dec 24, 2020 · 1 comment
Open

Query With Custom Sorting, Occurrences In String Array #1586

ljs19923 opened this issue Dec 24, 2020 · 1 comment
Labels
type:question Support or code-level question

Comments

@ljs19923
Copy link

Hi,
I want to know if it's possible to sort my query in this way.

My className is called "Shop"

Each shop have a field called "campaignsDateString" who is an array of String like that :
["8/28/2020", "8/30/2020", "8/31/2020", "8/31/2020","9/1/2020"]

On my query I want to get all shops who have campaigns for specifics dateString, who is also an array of String
["8/28/2020", "8/30/2020]

So on my query I have this constraint
query.whereKey("campaignsDateString", containedIn:["8/28/2020", "8/29/2020])

if for example I have 2 shops like this
SHOP1
campaignsDateString = ["8/28/2020", "8/30/2020", "8/31/2020", "8/31/2020","9/1/2020"]

SHOP2
campaignsDateString = ["8/28/2020", "8/28/2020","8/28/2020", "8/28/2020","8/28/2020", "8/28/2020"]

I want to sort my results by occurrences of campaignsDateString matching my array ["8/28/2020", "8/29/2020]
The second shop have 5 times "8/28/2020" and the first shop only one time, so i want to get Shop 1 in first.

If someone have an idea of how to do that.
Thanks

@cbaker6 cbaker6 added the type:question Support or code-level question label Jan 6, 2021
@stale
Copy link

stale bot commented Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. If you believe it should stay open, please let us know! As always, we encourage contributions, check out the Contributing Guide

@stale stale bot added the Stale label Jul 21, 2021
@mtrezza mtrezza removed the Stale label Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

3 participants