It could be achieved by
@Query(value = " SELECT *\n" +
" FROM container_name km\n" +
" WHERE array_contains(@ids, km.id, true))\n" +
" ORDER BY km.createdDate DESC ")
Flux<ContainerData> findAllById(@Param("ids") Iterable<String> ids);
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
0
I am trying to create(using spring native query) the findAllId for the reactive repository spring data cosmo DB. Since for the ReactiveCosmosRepository is not implemented.
@Query (value = " SELECT *\n" +
" FROM container_name km\n" +
" WHERE km.id IN (@IDS_test ) \n" +
" ORDER BY km.createdDate DESC ")
Flux<ContainerData> findAllById(@Paramjeet Dahiya ("ids") String[] ids);
or even
@Query (value = " SELECT *\n" +
" FROM container_name km\n" +
" WHERE km.id IN (@IDS_test ) \n" +
" ORDER BY km.createdDate DESC ")
Flux<ContainerData> findAllById(@Paramjeet Dahiya ("ids") Iterable<String> ids);
but it is not retrieving any results, and it is not throwing any exception either.
So the question is, how to use IN operator with spring data native query in cosmos db and collection or array out of the box without having to do a workaround.
It could be achieved by
@Query(value = " SELECT *\n" +
" FROM container_name km\n" +
" WHERE array_contains(@ids, km.id, true))\n" +
" ORDER BY km.createdDate DESC ")
Flux<ContainerData> findAllById(@Param("ids") Iterable<String> ids);