-
How can I filter for an entity whose array contains an element? I have an entity like so: type Config @entity @mongodb {
id: ID! @id(from: "db") @alias(value: "_id")
textChannelIds: [String!]
voiceChannelIds: [String!]
categoryId: String
} I'd like to filter for all version of the I've tried |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
At the moment it's not supported. We'll work on it ASAP. A possible workaround could be to transform your model as follow: type Config @entity @mongodb {
id: ID! @id(from: "db") @alias(value: "_id")
textChannelIds: [ConfigTextChannel!] @foreignRef
voiceChannelIds: [ConfigVoiceChannel!] @foreignRef
categoryId: String
}
type ConfigTextChannel @entity @mongodb {
id: ID! @id(from: "db") @alias(value: "_id")
configId: ID!
value: String!
}
type ConfigVoiceChannel @entity @mongodb {
id: ID! @id(from: "db") @alias(value: "_id")
configId: ID!
value: String!
} And executing the find on the |
Beta Was this translation helpful? Give feedback.
-
@Atlinx if you want try out the prerelease 2.1.4-1 it has the feature that you suggested. The GraphQL query become: query {
configs(filter: { textChannelIds: { has: "2093470923843" } }) {
id
}
} |
Beta Was this translation helpful? Give feedback.
At the moment it's not supported. We'll work on it ASAP.
A possible workaround could be to transform your model as follow:
And executing the find on the
ConfigTextChannel
or theConfigVoiceChannel
and then find theC…