Fix mongo save new document/update document

This commit is contained in:
Laurent Nguyen 2024-04-22 10:57:26 +02:00
parent 45a64df0a2
commit 6b3df52185
1 changed files with 8 additions and 1 deletions

View File

@ -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();