Skip to content

Should spring data couchbase handle list as JsonArray [DATACOUCH-337] #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Sep 20, 2017 · 2 comments
Assignees
Labels
in: core Issues in core support type: bug A general bug

Comments

@spring-projects-issues
Copy link

Labusquiere opened DATACOUCH-337 and commented

I'm expecting :

@Query("#{#n1ql.selectEntity} WHERE (ANY v in externals SATISFIES v.codeSI in $ids END) AND #{#n1ql.filter}")
List<BouquetEntity> myQeury(@Param("ids") JsonArray ids);

generate the following :

SELECT META(`sekai`).id AS _ID, META(`sekai`).cas AS _CAS, `sekai`.* FROM `sekai` WHERE (ANY v in ids SATISFIES v.codeSI in ["value1","value2"] END) AND `_class` = \"ServicePlan::BouquetEntity\"

I did try with varargs, array and debug a bit and for me it s today impossible. Am I wrong? is there an other way to do it with @Query or it is not supported ?


Affects: 2.1.11 (Hopper SR11), 2.2.8 (Ingalls SR8), 3.0 GA (Kay)

@spring-projects-issues
Copy link
Author

David Kelly commented

I did a simpler one:

@Query("#{#n1ql.selectEntity} where callsign In $callsigns")
List<Airport> findByCallsigns(JsonArray callsigns);

And this one works as I'd expect - the query generated looks like this (from trace logging):

2019-06-28 15:55:36,501 DEBUG .repository.query.AbstractN1qlBasedQuery: 151 - Executing N1QL query: {"statement":"SELECT META(`travel-sample`).id AS _ID, META(`travel-sample`).cas AS _CAS, `travel-sample`.* FROM `travel-sample` where callsign In $callsigns","$callsigns":["CITRUS","TXW"],"scan_consistency":"statement_plus"}

What was the query actually generated? I'm guessing I'm missing something, but JsonArray as a parameter seems to be working as expected for this simple thing I've done above

@mikereiche
Copy link
Collaborator

#1650 Added converters for JsonNode, JsonObject and JsonArray

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants