Hi channel! I've got a problem trying to query a l...
# prisma-whats-new
k
Hi channel! I've got a problem trying to query a list of events by a range (I want a list of events which are before or after a date, so I can filter passed events or events in the future) My schema is:
Copy code
type Event @model {
  id: ID! @isUnique
  title: String!
  description: String!
  type: String
  dateTime: DateTime!
  location: String!
  image: String
  attendants: [Attendant!]! @relation(name: "EventHasAttendant")
  minAttendants: Int!
  maxAttendants: Int!
  updatedAt: DateTime!
  createdAt: DateTime!
}
My query is something like:
Copy code
{
  allEvents(filter: {dateTime: "2017-11-18T23:00:00.000Z"}) {
    id
    title
    description
    type
    dateTime
    location
    image
    attendants {
      id
      email
      name
    }
    minAttendants
    maxAttendants
  }
}
Could you help me? I don't know if in this case I should use Graphcool Functions.
e
Your current query filters events by exactly given date. To get past or future events to/from date you should use dateTime_lt (less than) or dateTime_gt (greater than). https://www.graph.cool/docs/reference/graphql-api/query-api-nia9nushae/#explore-available-filter-criteria Scroll till Explore available filter criteria to see all options
k
Oh really nice! Thank you so much @emils