Mongo DB document validation failed

Hi Team,
I am facing the error below while inserting one document

db.getCollection("task-templates").insert({"taskTemplateId" : "788281802383956355", "playbookTemplateId" : "661636468", "subject" : "reteyyyyyyyyyyyyyy", "taskTypeId" : "702875519296739235", "taskTypeName" : "Compliance", "priority" : "MEDIUM", "ownerType" : "CUSTOM", "owners" : [ "1" ], "franchiseeAccess" : "NONE", "creationDate" : ISODate("2023-05-16T05:50:27Z"), "templateTimeline" : { "relativeTimeline" : { "start" : { "days" : 0, "hours" : 0, "scheduleType" : "AFTER" } }, "timeless" : true }, "tenantId" : "nocustomerdb.franconnect.net", "taskEmailReminder" : false, "deleted" : false, "archived" : false, "creatorUserNo" : "1", "moduleId" : "32", "templateType" : "PLAYBOOK_TASK_TEMPLATE", "externalFileUploadAllowed" : false, "completeTaskOnUpload" : false, "ownersPlaceHolders" : [ ], "_class" : "com.franconnect.taskmanagement.domain.TaskTemplate"});
WriteResult({
        "nInserted" : 0,
        "writeError" : {
                "code" : 121,
                "errmsg" : "Document failed validation"
        }

Can someone help with this please find the validation rules?

If you download and use MongoDB Compass, it can display the validation rules for a database.

1 Like