Skip to content

Arango query is flattening nested attributes #514

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
Gajanana opened this issue Jul 31, 2023 · 3 comments · Fixed by #517
Closed

Arango query is flattening nested attributes #514

Gajanana opened this issue Jul 31, 2023 · 3 comments · Fixed by #517
Assignees
Labels

Comments

@Gajanana
Copy link

I have document as below

{
"att1": 32,
"att2": 36,
"properties" :{
"att3" : "str1",
"att4": "str2"
}

I am passing type as BaseDocument.class in arango query

<T> ArangoCursor<T> query(String query, Class<T> type, Map<String, Object> bindVars, AqlQueryOptions options);

Earlier in 6.x . retrieving att3 was done as below

(String) ((HashMap<String, Object>)baseDocument.getAttribute("properties")).get("att3"))

Now in 7.X basedocument is flattened in returned basedocument and I have to retrieve att3 as below whereas i was expecting it to work as before matching my arango document structure

(String) (baseDocument.getAttribute("att3"))
@rashtao
Copy link
Collaborator

rashtao commented Sep 12, 2023

This is a change introduced since version 7.
To get all properties as Map<String, Object> you can still use BaseDocument#getProperties().

@Gajanana
Copy link
Author

What will happen if we have same attribute as nested as well as in outer layer Ex

{
"did": 32,
"att0": 36,
"properties" :{
"did" : "str1",
"att1": "str2"
}

@rashtao
Copy link
Collaborator

rashtao commented Sep 12, 2023

Thanks for clarifying, the PR above should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants