Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
None
-
0
Description
Code:
const couchbase = require('couchbase') |
const main = async () => { const cluster = await couchbase.connect('couchbases://cb.3c28ba8gdztn4hgi.cloud.couchbase.com', { username: 'Administrator', password: 'Password' }) const bucket = cluster.bucket('travel-sample') const collection = bucket.defaultCollection() |
const getSubDocument = async (key, field) => { try { var result = await collection.lookupIn(key, [ couchbase.LookupInSpec.get(field), ]) var fieldValue = result.content[0].value |
console.log('LookupIn Result: ') console.log(result) |
console.log(`Field Value: `) console.log(fieldValue) } catch (error) { console.error(error) } } |
getSubDocument('airline_10', 'country') .then(() => process.exit(0))} |
main()
|
|
Output:
LookupIn Result:
|
LookupInResult {
|
content: [ LookupInResultEntry { error: null, value: 'Canada' } ], |
cas: Cas<1666527479337189376> |
}
|
Field Value:
|
Canada
|
But when I am trying to do the same with WAN Profile
Code:
const couchbase = require('couchbase') |
const main = async () => { const cluster = await couchbase.connect('couchbases://cb.3c28ba8gdztn4hgi.cloud.couchbase.com', { username: 'Administrator', password: 'Password' }) cluster.applyProfile('wanDevelopment') const bucket = cluster.bucket('travel-sample') const collection = bucket.defaultCollection() |
const getSubDocument = async (key, field) => { try { var result = await collection.lookupIn(key, [ couchbase.LookupInSpec.get(field), ]) var fieldValue = result.content[0].value |
console.log('LookupIn Result: ') console.log(result) |
console.log(`Field Value: `) console.log(fieldValue) } catch (error) { console.error(error) } } |
getSubDocument('airline_10', 'country') .then(() => process.exit(0))} |
main()
|
|
Output: