Problem accessing the metrics in query result



I am using N1QL in my Node Js and have a function which executes the query and returns the result

const getBucketList = (bucket, N1qlQuery)=>{
   return new Promise((resolve,reject)=>{
   query = N1qlQuery.fromString(q.qLeadBuckets);
bucket.query(query, (err, result)=>{

  if(err) return reject(err);
          return resolve(result)

and here is my QueryString

qLeadBuckets : select _type || "::" || _id as id , text , 0 as selected from Contacts c where c._type= "leadbucket" order by c.sort_order

my result looks like this

[ { id: ‘leadbucket::D6802064-8AC5-4E5A-855E-B59C32859C81’,
selected: 0,
text: ‘New Lead’ },
{ id: ‘leadbucket::1268F5B4-9BB1-4A76-BCEF-3BE1D59BF97C’,
selected: 0,
text: ‘Short-Term Leads’ },
{ id: ‘leadbucket::C97632BE-5A24-4AE7-8D18-4DFE174F0D0F’,
selected: 0,
text: ‘Long-Term Buyers’ } ]

Question is how can i access the query metrics ? as result.metrics is undefined


Hey @makeawish,

There is actually a third parameter to the query callback which contains the meta (including metrics):

bucket.query(query, (err, result, meta)=>{
  // meta.metrics

Cheers, Brett