-
Notifications
You must be signed in to change notification settings - Fork 192
"id" as field name getting populated with meta().id in the response #1258
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
Comments
Please include the entity class and the repository class in the issue. |
The response is correct as that's what the decoder does - return meta().id of the document in the @id field (or the field named 'id' if there is no other field annotated with @id). |
If the issue persists with documents inserted using spring-data-couchbase, please reopen. |
See CBSE-10927 The issue is that decode uses property.isIdProperty() to determine if a field is the id field. It should use property == entity.getIdProperty(). This is the check that should be use everywhere instead of property.isIdPropery(). Also StringBasedN1qlParser.getProjectedFieldsInternal() needs to use property = entity.getIdProperty() otherwise it will not project the field name id that is not an IdProperty. |
Closes #1258. Co-authored-by: mikereiche <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
The documents having "id as field name not getting populated with the correct value in the response via spring-data Couchbase.
The stored value for id field is getting replaced with document meta().id when we fetch data using the query below.
@query("SELECT * FROM #{#n1ql.bucket} WHERE id = $1")
Example:
Below is the Document data stored in Couchbase: (meta().id => c00994b8-b547-4388-a549-e1543edbd9c8)
{
"id": "eeb7afa9-3ada-483d-ac1a-7efcf6e7b232",
“name”: “John”
}
Response object retrieved via NQL query above:
{
"id": "c00994b8-b547-4388-a549-e1543edbd9c8",
“name”: “John”
}
The text was updated successfully, but these errors were encountered: