seung-00 commented on code in PR #4987:
URL: https://github.com/apache/zeppelin/pull/4987#discussion_r2233806711


##########
mongodb/src/main/resources/shell_extension.js:
##########
@@ -104,6 +104,26 @@ function printTable(dbquery, fields, flattenArray) {
     printTable(this, fields, flattenArray);
 };
 
+function ensureTableFunction() {
+    var tableFunc = function(fields, flattenArray) {
+        printTable(this, fields, flattenArray);
+        return this;
+    };
+
+    try {
+        var sampleCursor = db.getCollection('__dummy__').find({}).limit(0);
+        var proto = Object.getPrototypeOf(sampleCursor);
+
+        if (proto && !proto.table) {
+            proto.table = tableFunc;

Review Comment:
   Shouldn't we apply `tableLimit` here as well, like in line 102?



##########
mongodb/src/main/resources/shell_extension.js:
##########
@@ -104,6 +104,26 @@ function printTable(dbquery, fields, flattenArray) {
     printTable(this, fields, flattenArray);
 };
 
+function ensureTableFunction() {
+    var tableFunc = function(fields, flattenArray) {
+        printTable(this, fields, flattenArray);
+        return this;
+    };
+
+    try {
+        var sampleCursor = db.getCollection('__dummy__').find({}).limit(0);
+        var proto = Object.getPrototypeOf(sampleCursor);
+
+        if (proto && !proto.table) {
+            proto.table = tableFunc;
+        }
+    } catch (e) {
+        print("Registration Error: prototype registration failed:", e.message);
+    }
+}

Review Comment:
   What do you think about merging the existing table prototype logic into 
`ensureTableFunction` to avoid duplication?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to