创建带有参数的GraphQL查询?

时间:2020-04-16 03:12:24

标签: graphql

我是graphQL查询的新手,在返回用指定chatID过滤的消息列表时遇到麻烦。我现在的结果是,我得到了所有消息的列表(未按聊天ID过滤)。

这是我的查询:

Cell.Value = Val(Cell.Value) * 1

我的查询变量:

query listMessages($chatID: String!) {
  listMessages(chatID: $chatID) {
    items {
      ID
      chatID
      content
      author
      createdAt
    }
  }
}

模式:

{"chatID": "6" }

查询结果示例:

 type Message {
    ID: String!
    chatID: String!
    content: String!
    author: String!
    createdAt: String!
}

type MessageConnection {
    items: [Message]
    nextToken: String
}

type Query {
    getMessage(ID: String!): Message
    listMessages(chatID: String!): MessageConnection
}

但是,我应该只收到带有chatID 6的消息,而不要同时接收这两个消息?看来无论输入什么,我的列表都会返回所有消息?

0 个答案:

没有答案