[Solved] How to get value in multi get results?

query
#1

Any idea how to return value from multi get request?

result will return undefined but work fine for single get request.

bucket.getMulti(['playlist::4de01004-e125-4d48-84b5-f6d3a45b3b3a', 'playlist::6bb9f56d-a05d-4a52-b0e3-c901b041e873'], function(error, results) {
      // here
      console.log(results.value);
     // results: undefined
});

Here code from single get:

bucket.get(‘playlist::6bb9f56d-a05d-4a52-b0e3-c901b041e873’, function(error, results) {
console.log(results);
});

Single get request results:

{ cas: CouchbaseCas<71646396350464>,
value:
{ owner:
{ firstName: ‘Melinda’,
lastName: ‘Gregory’,
created: 1423319541000,
title: ‘Ms’,
updated: ‘2015-08-25T10:29:26’,
picture: [Object],
username: ‘enlargesprolonged66905’ },
visibility: ‘PRIVATE’,
created: ‘2015-08-07T23:21:59’,
name: ‘Playlist # 2 for Melinda’,
id: ‘6bb9f56d-a05d-4a52-b0e3-c901b041e873’,
type: ‘playlist’,
updated: ‘2015-09-11T10:39:44’,
tracks:
[ ‘D0FAA90F6A41A40FFD86DA7271BBC7249EC07FF4’,
‘9D2163ACAFEE3A59FDAE1645215A662876B7196A’,
‘081B48A66C0D673DF76A219687FB1E917ED78C3D’,
‘4EA4EB361D04C32E312FA961480954E6FB8EEE88’,
‘8F73EF78F7D129710B4580EA73812BA97A6905C7’,
‘BC1380832F351A62F91B7FF88FBEDA3DB4D83B1C’ ] } }

Fix it with for …in loop :

 for (var prop in results) {
     console.log(results[prop].value.owner);
 }
#2

Solution:

Using for …in loop:

 for (var prop in results) {
     console.log(results[prop].value.owner);
 }

or using forEach() method.