DESCRIPTION

Suggestion: Correction for includeDocs = false option

Motivation
----------
'includeDocs = false' option should have NULL for each documents.

Modifications
-------------
don't call bucket.get() for explicit NULL document.

Result
------
intentional includeDocs=false can get only view query result,
which is much more faster result than original
since do not waiste redundant network resources for getting each document.

Change-Id: Icc43155e5dd4467de602905a1b18e26ebad76f7a

COMMENTS

author: Paulina Bailey
date: 2016-01-28 05:20:10.229000000

Patch Set 2: Commit message was updated

-------------------------------------
author: Natasha Sullivan
date: 2016-01-28 05:36:50.564000000

Patch Set 2:

Hi,

thanks very much for your contribution. Unfortunately I don't think we can take this patch, let me explain why:

If you are working in an a synchronous context, it might make sense, but the whole idea is that if you are working async only, you can on demand load the document when you call document(). 

So what the code does it checks if the document has already been loaded in the past (because it was put in when includeDocs is set) and then immediately returns it.

So: if you never call document() it is also never lazily loaded, having no overhead. So if you don't set includeDocs AND never call document(), it is never loaded and you have no overhead. Is that possible in your situation?

What we can think about improving is if you call .document() multiple times to cache it inside the row.

-------------------------------------
author: Paulina Bailey
date: 2016-01-28 06:04:04.712000000

Patch Set 2:

Ok, I understand what you said.

Just don't call document(), bucket.get(id) operation does not run.
But, some people implemented toList().toBlocking().single() and then access documents and null checked it. :-(

Good. I will guide them NOT to access document when you don't need 'document' access.

 > Hi,
 > 
 > thanks very much for your contribution. Unfortunately I don't think
 > we can take this patch, let me explain why:
 > 
 > If you are working in an a synchronous context, it might make
 > sense, but the whole idea is that if you are working async only,
 > you can on demand load the document when you call document().
 > 
 > So what the code does it checks if the document has already been
 > loaded in the past (because it was put in when includeDocs is set)
 > and then immediately returns it.
 > 
 > So: if you never call document() it is also never lazily loaded,
 > having no overhead. So if you don't set includeDocs AND never call
 > document(), it is never loaded and you have no overhead. Is that
 > possible in your situation?
 > 
 > What we can think about improving is if you call .document()
 > multiple times to cache it inside the row.

-------------------------------------
author: Paulina Bailey
date: 2016-01-28 06:21:44.576000000

Abandoned

-------------------------------------
author: Natasha Sullivan
date: 2016-01-28 06:31:43.747000000

Patch Set 2:

Okay, maybe what you can do in your code: you have includeDocs set to true/false somewhere, so pass that down into the other scope OR wrap the result that prohibits checks on a document.

-------------------------------------
