couchbaselabs / node-ottoman

Node.js ODM for Couchbase
https://ottomanjs.com/
Apache License 2.0
287 stars 98 forks source link

Model.find() does not expose metrics for profiling #794

Open aschneidz opened 3 days ago

aschneidz commented 3 days ago

The response of a model.find() object does not include the metrics object which can be found in the native nodeJS SDK, instead it comes through as undefined.

  meta: QueryMetaData {
    requestId: '31e63cf5-39a7-4032-930e-73e9be15789a',
    clientContextId: 'f29f81-a12a-7340-5d43-67850195bcbc34',
    status: 'success',
    signature: {
      _type: 'json',
      email: 'json',
      firstName: 'json',
      id: 'json',
      lastName: 'json',
      num: 'json'
    },
    warnings: [],
    metrics: undefined,
    profile: undefined
  }
}

Attempting to set the options flag from the NodeJS SDJK like so, also does not work: result = await Test.find({ firstName: 'Major' }, { metrics: true });

Can this please be exposed in Ottoman so we can monitor query performance during development?

aschneidz commented 3 days ago

@ejscribner FYI

aschneidz commented 1 day ago

To solve this, Ottoman will need to handle the queryOptions for .find() and other query based methods