How to use lookupIn


#1

In couchbase document , there is no document for lookupIn usage for node js

http://docs.couchbase.com/sdk-api/couchbase-node-client-2.0.8/index.html does not contains DocumentFragment

Also example of https://docs.couchbase.com/nodejs-sdk/2.5/subdocument-operations.html#retrieving is not javascript , it is PHP and python

How can I get content of DocumentFragment ?

According to https://github.com/couchbase/couchnode/blob/master/lib/bucket.js#L2823 I can use contentByIndex and content methods

Can I use contents property directly? ot it is for internal usage?

const [field1,field2] = result.contents;

#3

Any idea???


#4

Hey @socketman2016,

Unfortunately it is not possible to use the contents data directly. Lookup must be performed using the provided methods in order to correctly index into the results. What are you trying to achieve, perhaps there is an alternative solution we can work out?

Cheers, Brett


#5

The newer ES6 syntax is easier to use

const [field1,field2] = result.contents;

#6

Hi @socketman2016,
The recent move of the Documentation platform has left a number of what were once common files across the SDKs, which in the new format are rather unsatisfactory. Having a little time to repair this after getting the latest Couchbase release documented, the team are now working on these, including the Sub-Document operations.

If you want to keep an eye on progress, the relevant ticket is https://issues.couchbase.com/browse/DOC-4115

Cheers, Richard