Skip to content
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

CouchbaseTemplate#findByView is always including documents in ViewResponse. [DATACOUCH-28] #343

Closed
spring-projects-issues opened this issue Sep 19, 2013 · 5 comments
Assignees
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: bug A general bug

Comments

@spring-projects-issues
Copy link

Maciej Zasada opened DATACOUCH-28 and commented

We have the couchbase view which does JSON transformation (removing unnecessary fields, etc). When using

org.springframework.data.couchbase.core.CouchbaseTemplate#findByView

we can't specify to not include whole documents in the ViewResponse. It seems that problematic code snippet is:

if (!query.willIncludeDocs()) {
  query.setIncludeDocs(true);
}

which will always end up with setting query.setIncludeDocs(true). It would be useful, if one could disable this option on demand, e.g. for performance reasons


Affects: 1.0 M1

@spring-projects-issues
Copy link
Author

David Harrigan commented

Hi,

My 2C's:

Perhaps we should trust the developer to "do the right thing" (tm) :-). Instead of forcing the query to include the docs, let's rely on the developer to set the "willIncludeDocs" if they want docs, otherwise it's their fault if they don't set this attribute and no docs are returned.

I would imagine that with a bit of clear JavaDoc and the expectation that the Developer understands the basic query API, they will realise that if they want docs, they must set this value.

-=david=-

@spring-projects-issues
Copy link
Author

Michael Nitschinger commented

makes sense guys.. I originally had that in to aid my repository implementation, but since it's causing issues I'll make that better. looking forward to add it in M2

@spring-projects-issues
Copy link
Author

David Harrigan commented

#7 created.

Just a bit unsure about SimpleCouchbaseRepository, is it okay to setIncludeDocs(true) at line 122?

-=david=-

@spring-projects-issues
Copy link
Author

David Harrigan commented

Updated pull request based upon Michael's kind feedback.

#8

-=david=-

@spring-projects-issues
Copy link
Author

Michael Nitschinger commented

Note that after discussion and thought, this won't be fixed. Here's the reason (copied from the github conv):

@dharrigan I looked at this once more in the codebase and I know remember why I did it originally. Let's talk it through so we got an the same line..

in the findByView, I get a list of marshalled objects back, but when setIncludeDocs is not set to true always the method won't return useful data (because I have nothing to marshal from).

If you look down further, there is the queryView method which lets you access the query result directly (while still getting the exception mapping).

That's also why I force reduce to false because if you have a reduced view I can't get the object ids from the result

@spring-projects-issues spring-projects-issues added type: bug A general bug status: declined A suggestion or change that we don't feel we should currently apply labels Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants