Include_docs in viewquery Node.JS2.0

why “include_docs” option in viewQuery is gone,
is there a link for for using viewquery object in v 2.0

Hey doronaviguy,

We have have actually recently provided a fix for this, it will be available in our release pending for Nov 4th. As a workaround for now, you should be able to do .custom({include_docs: 'true'}) on the query to have the document contents included.

Cheers, Brett

1 Like

Thanks , probably missed that

when I use custom() for include_docs i get:


SyntaxError: Unexpected end of input
    at Object.parse (native)
    at IncomingMessage.<anonymous> (/media/data/workspace/cbnodeworkload/node_modules/couchbase/lib/bucket.js:534:33)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)
1 Like

Any update on this? Absence of this feature is show stopper for many projects.

There are two options which sucks.

  1. Client app can download items with additional requests
  2. docs can be set as value of in emit() function

Can this be fixed, please?

+1 Very annoying that include_docs doesn’t work.

This will be fixed soon – however keep in mind that server-side include_docs is no longer supported since version 3.0.0; rather any include_docs functionality is done on the client (the reason behind that the server executing the view would need to make client connections itself to get the related documents anyway).

Therefore, you are only looking at different variations of #1 (making individual requests for the documents). While this might look prettier when done on the client, it is not fundamentally different than issuing requests for the document yourself.

the reason behind that the server executing the view would need to make client connections itself to get the related documents anyway

This is a RIDICULOUS move by the devs, why would you remove such critical functionality from a View Query and kneecap the software?

What’s worse, is that on one server it works fine with ‘include_docs’ and then when I clone it with the exact same Node and Couchbase Server version, exact clone of bucket including design docs, I then get this when turning on include_docs:

SyntaxError: Unexpected end of input
at parse (native)

No explanation, no reason, just breaks. I’m seriously regretting using couch base.

I have to roll back to couchbase@2.1.3 for things to work properly.

Also your Node SDK documentation was written by an alien. Less weird lines like:

limit(limit) → {ViewQuery}

And more actual code samples.

Unbelievable… this issue still persists in later version of couchbase-node… no response… no suggestions… are you guys serious?

Hey @pikatore,

Could you describe exactly what you are trying to achieve? I would be happy to help you find the best way to solve your specific use-case. While the include_docs feature was deprecated from recent server versions, you can still use the document id available in the query results to fetch each of the documents through KV (which is far more performant).

Additionally, I mentioned previously that you are still able to issue a include_docs query with older versions of the server, but you have indicated that this is not working. Could you provide a sample of the code your using with ViewQuery which exhibits this issue?

Cheers, Brett

I have a function that is designed to single out the last entry in a view query, and pull the document down at the same time.

While I can appreciate that doing something more intensive won’t be as performant, it’s semantically intuitive to have an ‘include docs’ ability as writing code to do an iterative get on view query results is code diahorrea in my opinion.

Also where in the documentation does it state that include_docs is depreciated? It just doesn’t mention it, but considering how useful it is, it should probably be something clearly in bold.

Hey @pikatore,

In fact, the include_docs option which is available through direct view query is what is deprecated. The SDKs perform their own ‘logical include_docs’, by parsing through the results of your view query and automatically fetching the needed documents. Sorry for any confusion there.

Is there any additional details, or even a small example application you could show that would help us track down the source of this issue?

Cheers, Brett