Documentation says it should work. What am I missing ?
Summary
The user was getting an error 400 stating that NotEqual queries require exactly one value. They were trying to create a queries array and loop through a document list to add a NotEqual query to the array. Another user pointed out that each query is being AND'd together, so a separate query should be added to the array instead. The user then realized that passing an array makes it an OR condition, which would always be true. The user was trying to fetch documents from a collection using the query Query.NotEqual('Attribute 3', List<String values>), but it was not working. The solution is to provide a single value for
Drake
Nov 5, 2023, 03:37
Passing an array makes it an OR. So you're doing attr3 != val1 OR attr3 != val2 which would always be true
punti_z
Rank 3: Container
Nov 5, 2023, 03:39
Ah you are right, did not think it through. Any way to craft it so its "AND" since the list would be dynamic list of document ids ?
Drake
Nov 5, 2023, 03:40
Every query is AND'd with each other so add a separate query to the queries array
punti_z
Rank 3: Container
Nov 5, 2023, 03:55
Trying something but just so I dont end up wasting too much time on something dumb, I am planning to create a queries array List and loop through document list I dont want and will add a NotEqual query in that queries array. Is that the idea ?
punti_z
Rank 3: Container
Nov 5, 2023, 04:02
Worked .. Thanks
punti_z
Rank 3: Container
Nov 5, 2023, 04:03
[SOLVED] NotEqual queries require exactly one value (error 400)