List based filtering #1897
-
|
Hi, e.g. filter: { id:{ in:[1,2,3,4] }} or filter: { id:{ nin:[1,2,3,4] }} If not, is there an alternative approach that generates the same outcome? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
|
Hi @ascii1010, this can be achieved using the For example: Let's say you have an entity titled Using the following filter clause will select only the items with ids equal to 1,2 or 3. {
books(filter: { or: [{ id: { eq: 1 } }, { id: { eq: 2 } }, { id: { eq: 3 } }] }) {
items {
id
...
}
}
}For reference, here is the list of operators that are supported along with |
Beta Was this translation helpful? Give feedback.
-
|
Hi severussundar, is this currently possible for multiple fields? e.g. I want to get all the books that have ID 1-3 but I also want these books to be in the "Horror" or "Thriller" Genre. Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
@severussundar, thanks for the response. I've verified data is accurate. ContentMetadata is a nested object [array in the root object] and includes a string array, values. I've added the schema and sample data. The sample document should be returned as response but does not. Any idea why? Schema Data in Azure Cosmos DB Edited to add: replacing string array with an array of another object (see updated schema below), works. Would really like to see the string array work though... query Data in Azure Cosmos DB |
Beta Was this translation helpful? Give feedback.
-
|
@severussundar, updated to 0.11.12-rc but still see the same issue. If this case works for you, do you mind sharing the Cosmos DB document, query, and response? I'd like to compare with mine to see if it's user error. And the data is accurate Thanks for looking into this! It's much appreciated! |
Beta Was this translation helpful? Give feedback.


Hi @ascii1010, this can be achieved using the
oroperator.For example: Let's say you have an entity titled
bookand items with ids :1, 2 and 3 needs to be selected.Using the following filter clause will select only the items with ids equal to 1,2 or 3.
{ books(filter: { or: [{ id: { eq: 1 } }, { id: { eq: 2 } }, { id: { eq: 3 } }] }) { items { id ... } } }For reference, here is the list of operators that are supported along with
filter