garrensmith commented on a change in pull request #993: Display Mango execution 
statistics, when available
URL: https://github.com/apache/couchdb-fauxton/pull/993#discussion_r142933281
 
 

 ##########
 File path: app/addons/documents/mango/mango.api.js
 ##########
 @@ -115,15 +140,26 @@ export const mangoQueryDocs = (databaseName, queryCode, 
fetchParams) => {
     credentials: 'include',
     method: 'POST',
     body: JSON.stringify(modifiedQuery)
-  })
-    .then((res) => res.json())
-    .then((json) => {
-      if (json.error) {
-        throw new Error('(' + json.error + ') ' + json.reason);
-      }
-      return {
-        docs: json.docs,
-        docType: Constants.INDEX_RESULTS_DOC_TYPE.MANGO_QUERY
-      };
-    });
+  });
+};
+
+export const mangoQueryDocs = (databaseName, queryCode, fetchParams) => {
+  return supportsExecutionStats(databaseName).then((shouldFetchExecutionStats) 
=> {
+    if (shouldFetchExecutionStats) {
+      queryCode.execution_stats = true;
 
 Review comment:
   Can you add a note here that we can only add the execution_stats header if 
it is supported otherwise mango throws errors for unsupported json fields
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to