Cannot update schema of shared embedded object

Hello, I’m trying to make a schema update and I’m getting this error:

error fetching schema provider for schemas: at least two embedded schemas with different properties have the same title - “InvoicingContactDetails” - property “accountNumber” has default value “” in one schema and in another: please terminate sync first if you wish to make changes to the embedded schemas that share a title

Basically, in the Client collection I have two embedded objects (individualInvoicingInfo and businessInvoicingInfo), and both of them have an embedded object titled InvoicingContactDetails. I need to add a default value for the accountNumber string property of InvoicingContactDetails and this is causing the error.

The change: add "default": "" to accountNumber in both places.

Current schema for Client collection:

{
“properties”: {
“_id”: {
“bsonType”: “objectId”
},
“businessInvoicingInfo”: {
“properties”: {
“businessName”: {
“bsonType”: “string”
},
“contactDetails”: {
“properties”: {
“accountNumber”: {
“bsonType”: “string”
}
},
“required”: [
“accountNumber”
],
“title”: “InvoicingContactDetails”,
“type”: “object”
}
},
“required”: [
“businessName”
],
“title”: “BusinessInvoicing”,
“type”: “object”
},
“individualInvoicingInfo”: {
“properties”: {
“contactDetails”: {
“properties”: {
“accountNumber”: {
“bsonType”: “string”
}
},
“required”: [
“accountNumber”
],
“title”: “InvoicingContactDetails”,
“type”: “object”
},
“firstName”: {
“bsonType”: “string”
},
“lastName”: {
“bsonType”: “string”
}
},
“required”: [
“firstName”,
“lastName”
],
“title”: “IndividualInvoicing”,
“type”: “object”
},
},
“required”: [
“_id”,
],
“title”: “Client”,
“type”: “object”
}

Any chance I can avoid this and make the schema update? If not, should I rename one of the embedded schemas (and handle that in the client) or briefly terminate sync? I will need to do this in production, too.

Hi, are you using drafts by chance? I would expect that you can update both places in the same draft and that should be ok. Please let me know if not. Also, if you can provide a link to your application (URL in atlas cloud) I can take a look.

Thanks,
Tyler

Actually there is another collection using the embedded schema. I updated it to have the same default values and now the schema update worked.
Thank you for answering! My suggestion is that the error message should be more descriptive, to include the conflicting collection names. It would have been an easy fix.

Glad you were able to resolve the issue. And that is a fair point, I will file a ticket to clean up the error messaging.