From 9d20a13dd40cd891ced1fc46ccc3e450ed537b3c Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Tue, 12 Jan 2021 13:53:15 -0600 Subject: [PATCH] Warn on SubQuery (#378) --- src/Explorer/Tabs/QueryTab.html | 11 +++++++++++ src/Explorer/Tabs/QueryTab.ts | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Explorer/Tabs/QueryTab.html b/src/Explorer/Tabs/QueryTab.html index e27a4bb7c..ff4b40b06 100644 --- a/src/Explorer/Tabs/QueryTab.html +++ b/src/Explorer/Tabs/QueryTab.html @@ -11,6 +11,17 @@ Start by writing a Mongo query, for example: {'id':'foo'} or { } to get all the documents. +
+
+ Error + + We have detected you may be using a subquery. Non-correlated subqueries are not currently supported. + Please see Cosmos sub query documentation for further information + +
+
; + public maybeSubQuery: ko.Computed; public sqlQueryEditorContent: ko.Observable; public selectedContent: ko.Observable; public sqlStatementToExecute: ko.Observable; @@ -120,6 +119,11 @@ export default class QueryTab extends TabsBase implements ViewModels.WaitsForTem return (container && (container.isPreferredApiDocumentDB() || container.isPreferredApiGraph())) || false; }); + this.maybeSubQuery = ko.computed(function() { + const sql = this.sqlQueryEditorContent(); + return sql && /.*\(.*SELECT.*\)/i.test(sql); + }, this); + this.saveQueryButton = { enabled: this._isSaveQueriesEnabled, visible: this._isSaveQueriesEnabled