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

Filter by date #17

Open
Ximore opened this issue Feb 28, 2019 · 1 comment
Open

Filter by date #17

Ximore opened this issue Feb 28, 2019 · 1 comment

Comments

@Ximore
Copy link

Ximore commented Feb 28, 2019

I am trying to get latest posts from my collection, but want only to fetch those that are published until this day today. So I want to know how to fetch posts that are released at dates prior till today.

I tried to use the suggestion from this issue, but it doesn't seem to work neither as the $-sign is not accepted in GraphQL as a key.

{
    collection(name:"posts", filter:{published: true, date:{$lt: "2019-03-01"}})
}
@aheinze
Copy link
Member

aheinze commented Sep 6, 2019

query posts($filter: JsonType) {
  collection(name:"posts", filter:$filter)
}

with variables:

"filter":{"published": true, "date":{"$lt": "2019-03-01"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants