From 6b3df52185cf0854077e511ba2db55b610abb9f6 Mon Sep 17 00:00:00 2001 From: Laurent Nguyen Date: Mon, 22 Apr 2024 10:57:26 +0200 Subject: [PATCH] Fix mongo save new document/update document --- src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx index 006ea9052..c26256178 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx @@ -46,7 +46,6 @@ import { DocumentsTableComponent, DocumentsTableComponentItem } from "./Document export class DocumentsTabV2 extends TabsBase { public partitionKey: DataModels.PartitionKey; - private documentIds: DocumentId[]; private title: string; @@ -55,6 +54,7 @@ export class DocumentsTabV2 extends TabsBase { this.documentIds = options.documentIds(); this.title = options.title; + this.partitionKey = options.partitionKey; } public render(): JSX.Element { @@ -1041,6 +1041,13 @@ const DocumentsTabComponent: React.FunctionComponent<{ return; } + // Mongo uses BSON format for _id, trying to parse it as JSON blocks normal flow in an edit + // Bypass validation for mongo + if (props.isPreferredApiMongoDB) { + onValidDocumentEdit(); + return; + } + try { JSON.parse(newContent); onValidDocumentEdit();